Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When HTTPS port is changed requests to HTTP still redirect to port 443 #6

Open
mrsarm opened this issue Mar 17, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@mrsarm
Copy link
Contributor

mrsarm commented Mar 17, 2021

We let the user to change the ports through the $HTTP and $HTTPS environment variables, but the Nginx server section that has the configuration for the redirect from http:// to https:// don't use this configuration (default.conf.template#L3), so the redirect to the secure URL still lack of the port number that is defaulted by any browser to 443.

Changing the expression from:

return 301 https://$host$request_uri;

To:

return 301 https://$host$request_uri:${HTTPS};

Doesn't work, Nginx returns something like this in the HTTP 301 response header:

Location: https://192-168-1-3.my.local-ip.co/:10443

Note the / character before the : that makes the URL invalid.

Moreover, if the user only change the HTTP port but not the HTTPS port which may be the case in many configurations, the URL will include :443 at the end, which is valid but undesired (because 443 is the default and is ugly to see the number that isn't needed).

CC @newtewt

@mrsarm mrsarm added the bug Something isn't working label Mar 17, 2021
@mrjones-plip
Copy link
Contributor

Related: if possible, we should refrain from returning a 301 as that's cached as opposed to 302 which will be checked every request. In the case we want to go back to using http and have been sending 301, we'll have to fight browser cache etc.

Not sure if this is easy or buried in the docker stack somewhere hard to get to.

@mrsarm mrsarm changed the title When HTTPS port changed the HTTP redirect still redirects to port 80 When HTTPS port changed the HTTP redirect still redirects to port 443 Mar 17, 2021
@mrsarm mrsarm changed the title When HTTPS port changed the HTTP redirect still redirects to port 443 When HTTPS port is changed requests to HTTP still redirect to port 443 Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants