Welcome! Log In Create A New Profile

Advanced

Have full URL redirect to SSL (not just $server_name and $request_uri)

November 19, 2014 07:16AM
Hi -- we currently have a redirect rule in a location on our server to redirect all non-SSL traffic to SSL, like so:

location / {
return 301 https://$server_name$request_uri;
}

This works for almost all cases, but there is an edge case that is broken by this.
We have a custom subdomain functionality that our users use to give them more personalised-looking URLs, so they can use <username>.oursite.com
So username.oursite.com should redirect to https://username.oursite.com
And otheruser.oursite.com should redirect to https://otheruser.oursite.com

Could anyone advise me on what redirect rule I should use to achieve what our current rule does (redirects almost all traffic to HTTPS), and also redirects the special case.

Thanks very much for any and all assistance,
Doug.
Subject Author Posted

Have full URL redirect to SSL (not just $server_name and $request_uri)

biot023 November 19, 2014 07:16AM

Re: Have full URL redirect to SSL (not just $server_name and $request_uri)

Edho Arief November 19, 2014 07:18AM

Re: Have full URL redirect to SSL (not just $server_name and $request_uri)

biot023 November 19, 2014 09:22AM

Re: Have full URL redirect to SSL (not just $server_name and $request_uri)

Edho Arief November 19, 2014 09:40AM

Re: Have full URL redirect to SSL (not just $server_name and $request_uri)

biot023 November 19, 2014 10:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 291
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready