Caddy: 308 http to https redirect does not work with some ISPs

Created on 14 Sep 2020  路  2Comments  路  Source: caddyserver/caddy

I am seeing an issue where some ISPs (9 Mobile in Nigeria for example) do not correctly handle the 308 Permanent Redirect that Caddy responds with when upgrading an http Request to https. Clients will instead see a blank page saying Service unavailable and a ISP Logo that got MITMed. Upgrading a request via 301 Moved Permanently works as expected on such connections.

This is not really Caddy's fault (9 Mobile also injects ads into everything sent over http and similar), yet it means we can't really use Caddy in such markets as it cuts off everyone from our product that does not provide the https protocol in the URL. I can see the status code for this redirect is hard coded and not configurable here: https://github.com/caddyserver/caddy/blob/66863aad3beb480a26664c77b73eb2ff7fcab754/modules/caddyhttp/autohttps.go#L324

Is there any way for us to make Caddy respond with a 301 instead?

question

Most helpful comment

Strange. That's unfortunate.

You can override the existing redirects by setting up a site block like this:

http:// {
    redir https://{hostport}{uri} 301
}

For next time, please ask your usage questions on the Caddy community forums. We prefer to keep the GitHub issue board for bugs and feature requests. Don't forget to fill out the thread template so we can help you!

All 2 comments

Strange. That's unfortunate.

You can override the existing redirects by setting up a site block like this:

http:// {
    redir https://{hostport}{uri} 301
}

For next time, please ask your usage questions on the Caddy community forums. We prefer to keep the GitHub issue board for bugs and feature requests. Don't forget to fill out the thread template so we can help you!

solved my problem

Was this page helpful?
0 / 5 - 0 ratings