Failed HTTPS redirects to caddyserver.com

I have seen this before and It took me awhile to realise the issue.

I am using a Dockerized (The 0.2.1 version of this https://github.com/BlackGlory/caddy-proxy/) copy of Caddy using V0.10.3

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.

This occurs if you fail to provide a replacement Caddyfile.

https://github.com/BlackGlory/caddy-proxy/blob/78a176c5fb3a07285263da12504e61b469d8575d/Dockerfile#L22

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.

1 Like

@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.

Sorry for causing bother. Thank you again to @Whitestrake and @matt

Glad it’s all sorted! :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.