[PATCH] Added support for client_scheme_in_redirect directive

Maxim Dounin mdounin at mdounin.ru
Thu Mar 19 18:41:39 UTC 2015


On Wed, Mar 18, 2015 at 11:06:46AM -0700, Kyle Ibrahim wrote:

> Hi Maxim,
> I have considered something like `relative_redirects`. It would also be a
> good directive to have, but it wouldn't allow 301 redirects from nginx to
> always use the same hostname, e.g. www.example.com
> e.g.
> Currently, I need to set `server_name_in_redirect www.example.com` and MUST
> have nginx terminate SSL.
> `relative_redirects` wouldn't let me have nginx behind a SSL terminator AND
> use `server_name_in_redirect`, because the relative 301s wouldn't force
> people to move to www.example.com

Well, the question here is - what are you trying to achieve by 
such a setup?  It looks very strange, especially in a combination 
with SSL.

If the goal is to use one canonical name for a site, it should be 
much better solution to explicitly do redirects to a canonical 
name with an additional server{} block.

> I have also considered the option of: `scheme_in_redirect http|https` and
> not letting it have a variable. This would simplify the implementation by a
> lot.
> It wouldn't solve my exact problem, but it would solve the other two
> problems I linked in the beginning of my last email.

What email do you mean?  I see no links in this thread.

Maxim Dounin

More information about the nginx-devel mailing list