Using the docker container it picks up new domains and adds them to the Caddyfile. I have a Caddyfile that has the directive “tls off” in it and it works fine.
But when I tried to add a new sub domain that was NOT setup in DNS (I was trying to test the server) all requests get redirected to https://caddyserver.com/. with a 301 Moved Permanently
I assume this is by Design? Is so could something be added to the documentation? And would it make more sense to redirect to a page that actually talks about what is wrong (ie that a Certificate could not be generated)
I could not find anything with the Googles that suggests this - even though I now know the problem.
Strange. There’s nothing in Caddy’s code that redirects to https://caddyserver.com/. Since it’s a 301 redirect, make sure all your caches are cleared, etc. Something must be misconfigured with your container or other parts of your infrastructure.
Oh! - I did a quick grep of the code and I could not find anything but figured it was somewhere else.
That is strange. I have seen it before in older versions but figured it was something wrong with my config. When it resolved itself because the DNS kicked in I forgot all about it.
I am not sure what to say except Thanks for responding.
As you can see, the default Caddyfile proxies requests on port :80 to caddyserver.com, which defaults to HTTP, and the “upstream” http://caddyserver.com responds with a 301 redirect to https://caddyserver.com, which the caddy-proxy container faithfully passes on to you, the client, and your browser follows it.
@Whitestrake you are right - I missed that line. I think I know what happened now.
When ever I checked docker-gen had generated a file but Caddy had already loaded this file created with printf and was using it. Then when the file changed the changes were not loaded.