All reverse proxies stopped working after I change to a new router

1. Caddy version (caddy version): v2.4.5

2. How I run Caddy:

I run caddy using nssm and had no problem, until I upgrade my router from a TP-Link (WIFI5) to a Linksys (WIFI6)

a. System environment:

Windows 10

b. Command:

I use nssm to run caddy.

d. My complete Caddyfile or JSON config:

mw47.duckdns.org, mw47.mywire.org {
    encode gzip
    tls kkycble@hotmail.com
    route /radarr* {
	reverse_proxy 127.0.0.1:7878
    }
    route /sonarr* {
	reverse_proxy 127.0.0.1:8989
    }
    route /tautulli* {
	reverse_proxy 127.0.0.1:8181
    }
    route /lidarr* {
	reverse_proxy 127.0.0.1:8686
    }
    route /bazarr* {
	reverse_proxy 127.0.0.1:6767
    }
    route /jackett* {
	reverse_proxy 127.0.0.1:9117
    }
    route /petio* {
	reverse_proxy 127.0.0.1:7777
    }
    root * C:\rclone\organizr
    php_fastcgi 127.0.0.1:9000
    rewrite /api/v2/* /api/v2/index.php?{query}
    file_server
}
qb.mw47.duckdns.org, qb.mw47.mywire.org {
    encode gzip
    tls kkycble@hotmail.com
    reverse_proxy 127.0.0.1:8080
}

3. The problem I’m having:

reverse proxies not working after changing to a new router.

4. Error messages and/or full log output:

it says connection timed out on Chrome

5. What I already tried:

I’ve already forwarded port 80 and 443 on my new router. It’s worth mentioning that after forwarding port 16709, my plex’s remote access is back to normal.

Something’s weird as I used to be able to browse these app locally using 192.168.0.168:8989 (my old router), but now it should supposedly change to 192.168.1.90:8989 but it no longer works for me. qBittorrent’s 192.168.1.90:8080 works just fine tho

Are you sure you have ports 80 and 443 forwarded to the right device?

What’s in Caddy’s logs? When you set up the NSSM service, you can configure it to write stderr output to file. Look for the contents at the end of that file.

I am positive that it’s forwarded to the correct device. I don’t have logs enable tho. I currently just run as argument, how do I enable logging?

My NSSM setup looks something like this:

.\nssm.exe install caddy C:\Users\lavof\Documents\caddy\caddy.exe
.\nssm.exe set caddy AppParameters "run --config Caddyfile --watch"
.\nssm.exe set caddy AppDirectory C:\Users\lavof\Documents\caddy
.\nssm.exe set caddy AppExit Default Restart
.\nssm.exe set caddy AppNoConsole 1
.\nssm.exe set caddy AppStdout C:\Users\lavof\Documents\caddy\stdout.log
.\nssm.exe set caddy AppStderr C:\Users\lavof\Documents\caddy\stderr.log
.\nssm.exe set caddy AppTimestampLog 1
.\nssm.exe set caddy Description "Caddy Server"
.\nssm.exe set caddy DisplayName Caddy
.\nssm.exe set caddy ObjectName LocalSystem
.\nssm.exe set caddy Start SERVICE_AUTO_START
.\nssm.exe set caddy Type SERVICE_INTERACTIVE_PROCESS

In particular, this line is what will allow you to retain logs:

.\nssm.exe set caddy AppStderr C:\Users\lavof\Documents\caddy\stderr.log

Also, make sure you don’t have any Windows Firewall rules blocking connections on port 80/443.

1 Like

Thank you, I now have my log now. I ran netsh firewall show state and it didn’t show port 80 and 443 as blocked.

The log:

2021/09/10 15:02:03.785	e[34mINFOe[0m	using adjacent Caddyfile
2021/09/10 15:02:03.787	e[33mWARNe[0m	input is not formatted with 'caddy fmt'	{"adapter": "caddyfile", "file": "Caddyfile", "line": 2}
2021/09/10 15:02:03.791	e[34mINFOe[0m	admin	admin endpoint started	{"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["[::1]:2019", "127.0.0.1:2019", "localhost:2019"]}
2021/09/10 15:02:03.791	e[34mINFOe[0m	tls.cache.maintenance	started background certificate maintenance	{"cache": "0xc0003a85b0"}
2021/09/10 15:02:03.792	e[34mINFOe[0m	http	server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS	{"server_name": "srv0", "https_port": 443}
2021/09/10 15:02:03.792	e[34mINFOe[0m	http	enabling automatic HTTP->HTTPS redirects	{"server_name": "srv0"}
2021/09/10 15:02:03.797	e[34mINFOe[0m	tls	cleaning storage unit	{"description": "FileStorage:C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\Caddy"}
2021/09/10 15:02:03.797	e[34mINFOe[0m	http	enabling automatic TLS certificate management	{"domains": ["qb.mw47.mywire.org", "mw47.duckdns.org", "mw47.mywire.org", "qb.mw47.duckdns.org"]}
2021/09/10 15:02:03.801	e[34mINFOe[0m	tls	finished cleaning storage units
2021/09/10 15:02:03.806	e[34mINFOe[0m	autosaved config (load with --resume flag)	{"file": "C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\Caddy\\autosave.json"}
2021/09/10 15:02:03.806	e[34mINFOe[0m	serving initial configuration

The logs look fine, that’s just Caddy’s startup messaging.

At this point, I think it’s clear it’s not an issue with Caddy, but with your networking setup and/or router.

I don’t really have much else to suggest at this point.

1 Like

yeah, they used to work with no problem! These all started when I changed my router :frowning: Even on my local network, I can’t connect to Sonarr/ Radarr when using devices rather than the computer that I installed them on…

I just used canyouseeme.org to check my ports. It seems that port 80 and 443 both returned connection timed out. Could this be the problem?

Yes, that is the issue, ultimately.

1 Like

I fixed it! It’s just that changing my router changed my network profile on Windows 10 from “Private” to “Public”. Once I changed it back, they are working normally again. I feel like such a fool lol.

2 Likes

Fascinating. Would not have thought of that one.

Thanks for following up, I’ll add it to my mental playbook in case someone comes with a similar issue :grinning_face_with_smiling_eyes:

1 Like

Thank you for your help mate :slight_smile:

1 Like