The page isn’t redirecting properly, Caddy and Wordpress

This is the strangest thing! My new Wordpress site was working fine last night, today, suddenly not?

1. Output of caddy version:

$ caddy version
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

$ caddy reload

a. System environment:

Debian 11 vm

b. Command:

caddy reload

d. My complete Caddy config:

$ cat Caddyfile 
# Caddyconfig

kitsunehosting.net {
   # RP to lsio
   reverse_proxy https://10.85.3.10 {
        transport http {
          tls_insecure_skip_verify
        }
   }
}

# This one's for bitwarden
bitwarden.kitsunehosting.net {
   # RP to lsio
   reverse_proxy https://10.85.3.10 {
        transport http {
          tls_insecure_skip_verify
        }
   }
}


advancedmfg.llc {
        # For michael's website
        reverse_proxy http://10.85.3.87
        log {
                output file /var/log/caddy/advancedmfg.log {
                        roll_size 10mb
                        roll_keep 20
                        roll_keep_for 720h
                }
        }
}

3. The problem I’m having:

I am using cloudflare, Ive heard that can affect things quite a bit, it was working just like this last night and now, suddenly not? Very strange! I really changed nothing!
I have Wordpress running on another VM using docker, and serving at :80,

4. Error messages and/or full log output:

$ cat /var/log/caddy/advancedmfg.log
{"level":"info","ts":1667398669.0104265,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"108.162.242.28","remote_port":"54546","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Sec-Fetch-Site":["none"],"Cookie":[],"Accept-Encoding":["gzip"],"Cf-Ray":["763d7ef088e68c8f-YYZ"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Mode":["navigate"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Sec-Fetch-Dest":["document"],"Cdn-Loop":["cloudflare"],"Connection":["Keep-Alive"],"X-Forwarded-Proto":["https"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Fetch-User":["?1"],"Cf-Ipcountry":["US"],"X-Forwarded-For":["64.222.148.45"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Cf-Connecting-Ip":["64.222.148.45"]}},"user_id":"","duration":0.000041542,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[]}}
{"level":"info","ts":1667398669.221847,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"108.162.241.165","remote_port":"12316","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Accept-Encoding":["gzip"],"Cf-Ray":["763d7ef1ebee8c8f-YYZ"],"Accept-Language":["en-US,en;q=0.5"],"Cookie":[],"Cf-Connecting-Ip":["64.222.148.45"],"Connection":["Keep-Alive"],"X-Forwarded-Proto":["https"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Fetch-User":["?1"],"Cf-Ipcountry":["US"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Mode":["navigate"],"Cdn-Loop":["cloudflare"],"X-Forwarded-For":["64.222.148.45"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Site":["none"]}},"user_id":"","duration":0.000039397,"size":0,"status":308,"resp_headers":{"Content-Type":[],"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"]}}
... truncated ...
{"level":"info","ts":1667398813.2606227,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"62950","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Cdn-Loop":["cloudflare"],"Accept-Language":["en-US,en;q=0.5"],"Cookie":[],"Sec-Fetch-User":["?1"],"Cf-Connecting-Ip":["64.222.148.45"],"Cf-Ipcountry":["US"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Sec-Fetch-Dest":["document"],"Accept-Encoding":["gzip"],"X-Forwarded-Proto":["https"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Connection":["Keep-Alive"],"X-Forwarded-For":["64.222.148.45"],"Cf-Ray":["763d82769d6c8c8f-EWR"]}},"user_id":"","duration":0.000032252,"size":0,"status":308,"resp_headers":{"Content-Type":[],"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"]}}
{"level":"info","ts":1667398813.3851764,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"62960","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cf-Ipcountry":["US"],"Cdn-Loop":["cloudflare"],"Accept-Encoding":["gzip"],"X-Forwarded-For":["64.222.148.45"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-User":["?1"],"Cookie":[],"X-Forwarded-Proto":["https"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Cf-Ray":["763d82776f1b8c8f-EWR"],"Sec-Fetch-Site":["none"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Cf-Connecting-Ip":["64.222.148.45"],"Connection":["Keep-Alive"]}},"user_id":"","duration":0.000030775,"size":0,"status":308,"resp_headers":{"Content-Type":[],"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"]}}
{"level":"info","ts":1667398813.5271509,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"62964","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Accept-Encoding":["gzip"],"Cf-Connecting-Ip":["64.222.148.45"],"Cf-Ipcountry":["US"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Cookie":[],"Cdn-Loop":["cloudflare"],"Connection":["Keep-Alive"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Accept-Language":["en-US,en;q=0.5"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Sec-Fetch-Site":["none"],"X-Forwarded-For":["64.222.148.45"],"Cf-Ray":["763d827848da8c8f-EWR"],"X-Forwarded-Proto":["https"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"]}},"user_id":"","duration":0.000031063,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[]}}
{"level":"info","ts":1667398813.6840544,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"62976","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Upgrade-Insecure-Requests":["1"],"Cookie":[],"Cf-Ipcountry":["US"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Connection":["Keep-Alive"],"Accept-Encoding":["gzip"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Cdn-Loop":["cloudflare"],"Cf-Ray":["763d82794af68c8f-EWR"],"X-Forwarded-Proto":["https"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"X-Forwarded-For":["64.222.148.45"],"Cf-Connecting-Ip":["64.222.148.45"]}},"user_id":"","duration":0.000034828,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[]}}
{"level":"info","ts":1667398813.8578632,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"62988","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"X-Forwarded-Proto":["https"],"Accept-Language":["en-US,en;q=0.5"],"Accept-Encoding":["gzip"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Cdn-Loop":["cloudflare"],"Connection":["Keep-Alive"],"X-Forwarded-For":["64.222.148.45"],"Cf-Ray":["763d827a5d878c8f-EWR"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cf-Ipcountry":["US"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Cookie":[],"Cf-Connecting-Ip":["64.222.148.45"]}},"user_id":"","duration":0.000030498,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[]}}
{"level":"info","ts":1667398814.012161,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"62996","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Cf-Ipcountry":["US"],"Cf-Ray":["763d827b5f758c8f-EWR"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Cookie":[],"Cf-Connecting-Ip":["64.222.148.45"],"X-Forwarded-For":["64.222.148.45"],"X-Forwarded-Proto":["https"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-User":["?1"],"Connection":["Keep-Alive"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Sec-Fetch-Site":["none"],"Accept-Encoding":["gzip"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Accept-Language":["en-US,en;q=0.5"],"Cdn-Loop":["cloudflare"]}},"user_id":"","duration":0.00005754,"size":0,"status":308,"resp_headers":{"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[],"Server":["Caddy"]}}
{"level":"info","ts":1667398814.1410398,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"63006","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Connection":["Keep-Alive"],"X-Forwarded-For":["64.222.148.45"],"Accept-Language":["en-US,en;q=0.5"],"Upgrade-Insecure-Requests":["1"],"Cookie":[],"Cf-Ipcountry":["US"],"Accept-Encoding":["gzip"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Cf-Connecting-Ip":["64.222.148.45"],"Cdn-Loop":["cloudflare"],"Cf-Ray":["763d827c28fa8c8f-EWR"],"X-Forwarded-Proto":["https"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"]}},"user_id":"","duration":0.000029579,"size":0,"status":308,"resp_headers":{"Content-Type":[],"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"]}}
{"level":"info","ts":1667398814.2714903,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"63022","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"X-Forwarded-For":["64.222.148.45"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-User":["?1"],"Cf-Connecting-Ip":["64.222.148.45"],"Cdn-Loop":["cloudflare"],"Connection":["Keep-Alive"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Sec-Fetch-Site":["none"],"Cookie":[],"Cf-Ray":["763d827cea6f8c8f-EWR"],"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Proto":["https"],"Sec-Fetch-Mode":["navigate"],"Cf-Ipcountry":["US"],"Accept-Encoding":["gzip"]}},"user_id":"","duration":0.000030325,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[]}}
{"level":"info","ts":1667398814.516293,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"63038","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Cookie":[],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Accept-Language":["en-US,en;q=0.5"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Mode":["navigate"],"Cdn-Loop":["cloudflare"],"Cf-Ray":["763d827e6d3d8c8f-EWR"],"X-Forwarded-Proto":["https"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Sec-Fetch-Dest":["document"],"Cf-Ipcountry":["US"],"X-Forwarded-For":["64.222.148.45"],"Cf-Connecting-Ip":["64.222.148.45"],"Connection":["Keep-Alive"],"Accept-Encoding":["gzip"]}},"user_id":"","duration":0.000031909,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[]}}
{"level":"info","ts":1667398814.720011,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.70.230.35","remote_port":"63046","proto":"HTTP/1.1","method":"GET","host":"advancedmfg.llc","uri":"/","headers":{"Sec-Fetch-Site":["none"],"X-Forwarded-For":["64.222.148.45"],"Cf-Ray":["763d827fc8308c8f-EWR"],"X-Forwarded-Proto":["https"],"Accept-Language":["en-US,en;q=0.5"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Connection":["Keep-Alive"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"],"Upgrade-Insecure-Requests":["1"],"Cookie":[],"Accept-Encoding":["gzip"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Fetch-User":["?1"],"Cdn-Loop":["cloudflare"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Cf-Connecting-Ip":["64.222.148.45"],"Cf-Ipcountry":["US"]}},"user_id":"","duration":0.000033282,"size":0,"status":308,"resp_headers":{"Server":["Caddy"],"Connection":["close"],"Location":["https://advancedmfg.llc/"],"Content-Type":[]}}

5. What I already tried:

Ive tried enabling and disabling proxying! Also checked that i have SSL working and 443 responds and all that, looked at some other issues where people had a hard time getting cloudflare and caddy working together, my other site is up and running fine at the moment though.

6. Links to relevant resources:

Ah a clue! I had a friend test the site out and for them its up! I gave it a try and I hopped off my VPN, and the website is working! its just an internal thing, so, now I need to figure out why my loopback is not working :3

So it seems it only redirects like that if I’m inside the same network as caddy, the other website still works fine though.

1 Like

Many routers don’t handle hairpin NAT, so if you’re trying to access a site that resolves to your WAN IP, it doesn’t get routed back into your network.

A fix for this is to run a DNS server in your local network that resolves the domain to the LAN IP of your server instead, so devices inside the network can still connect.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.