I have a domain
https://dmytroengineering.com that works flawlessly with couldflare and a self hosted nginx instance though an Cloudflare Tunnel . However, when I add a CNAME record to point www to either
dmytroengineering.com or the tunnel, it does not work. I can resolve
www.dmytroengineering.com, but when I try to wget it I get a 503.
--2023-10-31 14:54:28-- https://www.dmytroengineering.com/ Resolving www.dmytroengineering.com (www.dmytroengineering.com)... 220.127.116.11, 18.104.22.168, 2606:4700:3034::6815:4618, ... Connecting to www.dmytroengineering.com (www.dmytroengineering.com)|22.214.171.124|:443... connected. HTTP request sent, awaiting response... 503 Service Unavailable 2023-10-31 14:54:28 ERROR 503: Service Unavailable.
When I wget
dmytroengineering.com alone, I see the request in nginx, when I use
www.dmytroengineering.com I don’t, so the request isn’t even being forwarded to the server. (This is with developer mode active to disable any caching). Both
www.dmytroengineering.com are defined as part of the website in the nginx config.
When I looked for solutions all of them mention contacting the service provider, but that’s not very useful when I am the service provider. Or they mention that I need an A record, but I can’t set the tunnel as a destination with that.
I setup a redirect rule to check if that would fix it and yes, it does, but I would prefer to not waste those on something that shouldn’t be necessary in the first place, and I would prefer to keep the website with www when that is what was requested initially.