Caddy 2 - Reverse Proxy Errors (Newbie)

1. Caddy version: Caddy 2

2. How I run Caddy:

I’m running Caddy from Windows Server and attempting to use it as a Reverse Proxy to provide a secure connection to my Emby Server. Note: I already have my Domain and SSL Cert setup.

a. System environment:

Windows Essentials Server where I have Caddy and Emby installed

b. Command:

Caddy run
Caddy start

c. Service/unit/compose file:

N/A

d. My complete Caddyfile or JSON config:

{
    email myemail@domain.com
 
}
 
jgcmedia.net {
    
   reverse_proxy http://192.168.1.99:80
 
}

3. The problem I’m having:

I’m trying to get Caddy 2 working with my Domain, SSL, Emby Server to provide a secure connection, however, I’m receiving errors when I run the “caddy run, start & stop” commands that I don’t fully understand…like I said, newbie. Also, I’m receiving this error when I try to access my domain:
This site can’t be reached

jgcmedia.net’s server IP address could not be found.</strong

Try:
Checking the connection
ERR_NAME_NOT_RESOLVED
–>

4. Error messages and/or full log output:

C:\Caddy>caddy run
2020/05/18 12:37:32.833 ←[34mINFO←[0m using adjacent Caddyfile
2020/05/18 12:37:32.841 ←[34mINFO←[0m admin admin endpoint started {“addres
s”: “tcp/localhost:2019”, “enforce_origin”: false, “origins”: [“localhost:2019”,
“[::1]:2019”, “127.0.0.1:2019”]}
2020/05/18 12:37:32.903 ←[34mINFO←[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}
2020/05/18 08:37:32 [INFO][cache:0xc00045d130] Started certificate maintenance r
outine
2020/05/18 12:37:32.904 ←[34mINFO←[0m http enabling automatic HTTP->HTTPS r
edirects {“server_name”: “srv0”}
2020/05/18 12:37:32.908 ←[34mINFO←[0m tls cleaned up storage units
run: loading initial config: loading new config: http app module: start: tcp: li
stening on :443: listen tcp :443: bind: An attempt was made to access a socket i
n a way forbidden by its access permissions.

C:\Caddy>caddy start
2020/05/18 12:37:42.777 ←[34mINFO←[0m using adjacent Caddyfile
2020/05/18 12:37:42.785 ←[34mINFO←[0m admin admin endpoint started {“addres
s”: “tcp/localhost:2019”, “enforce_origin”: false, “origins”: [“localhost:2019”,
“[::1]:2019”, “127.0.0.1:2019”]}
2020/05/18 12:37:42.787 ←[34mINFO←[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}
2020/05/18 08:37:42 [INFO][cache:0xc0005bfae0] Started certificate maintenance r
outine
2020/05/18 12:37:42.789 ←[34mINFO←[0m http enabling automatic HTTP->HTTPS r
edirects {“server_name”: “srv0”}
2020/05/18 12:37:42.793 ←[34mINFO←[0m tls cleaned up storage units
run: loading initial config: loading new config: http app module: start: tcp: li
stening on :443: listen tcp :443: bind: An attempt was made to access a socket i
n a way forbidden by its access permissions.
start: caddy process exited with error: exit status 1

C:\Caddy>caddy stop
2020/05/18 13:18:08.459 ←[33mWARN←[0m failed using API to stop instance
{“endpoint”: “http://localhost:2019/stop”, “error”: “performing request: Post "
http://localhost:2019/stop”: dial tcp [::1]:2019: connectex: No connection coul
d be made because the target machine actively refused it."}
stop: performing request: Post “http://localhost:2019/stop”: dial tcp [::1]:2019
: connectex: No connection could be made because the target machine actively ref
used it.

5. What I already tried:

I’ve checked the IP address (WAN/Public) associated to my Domain - via Google Domain is accurate.

I’ve tested the Port Forwarding for 80 and 443 and they both tested successful.

My Windows Server has a static IP address. I’ve opened Ports 80 and 443 on my Windows Firewall.

Please let me know if you need any additional information. Thanks for any assistance.

6. Links to relevant resources:

You don’t need to use start and run, just one or the other. “run” will keep Caddy attached to your terminal, so it only runs until you press Ctrl+C to cancel it. “start” will run Caddy in the background until you run “stop”.

You ran stop, but it failed because Caddy never finished starting up, there was nothing for it to try to stop.

This is telling you that Caddy wasn’t able to bind to port 443, which is the HTTPS port. It’s hard to say why, it could be for various reasons. I think the most probable is that your Windows security settings are blocking Caddy. The other possibility is that you already have another app using that port. Only one can use the port at a time. You’ll need to figure out which one that is and either change the port it uses or disable it entirely.

Thank you for your help. There was a conflict on my Windows Server preventing me to bind 443. Now all is well. Next learning adventure…how to start Caddy V2 Reverse Proxy as a Windows Service and how to create logs.

Thanks again

1 Like