but if you do that then you get redirected to https for all locations which is not what I want and if I wanted it I would do it without an if:
server {
listen 80;
server_name mydomain.com;
rewrite ^ https://$http_host$request_uri? permanent;
}
I only want all locations available through both http and https but a single location that has authentication where I want to force https. It seems that this is not possible with current nginx configuration options as the basic auth always takes precedence.
server {
listen 80;
server_name mydomain.com;
rewrite ^ https://$http_host$request_uri? permanent;
}
I only want all locations available through both http and https but a single location that has authentication where I want to force https. It seems that this is not possible with current nginx configuration options as the basic auth always takes precedence.