Welcome! Log In Create A New Profile

Advanced

Re: listen proxy_protocol and rewrite redirect scheme

Francis Daly
September 16, 2016 02:48PM
On Fri, Sep 16, 2016 at 11:12:16AM -0400, adrhc wrote:

Hi there,

> the browser request (https on 443) is received by sshttp which sends it to
> stunnel:1443 which proxy it to nginx:1080.
> When nginx receives the request it has $scheme = "http"; so, for any rewrite
> with "permanent" or "redirect" the Location header uses "http" while I
> really need "https" scheme.
>
> Is there any way for forcing nginx to change $scheme according to my will?
> or at least to generate the Location header with no scheme or with my
> desired scheme?

I think that stock nginx does not have a way to do this.

For any "rewrite" that you create, you can explicitly include "https://"
at the start -- but that will not help internally-generated things like
the trailing-slash redirect for directories.

If you want those, and your nginx is not doing its own ssl, I think you
would need a code change to get https: in the Location headers.

Not tested, but I suspect that removing four lines from
src/http/ngx_http_header_filter_module.c so that "*b->last++ ='s';" is
always called, might be enough for your newly-compiled nginx to always
redirect to https.

A proper fix would presumably involve a more general config option so
that it is selectable.

Cheers,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

listen proxy_protocol and rewrite redirect scheme

adrhc September 16, 2016 11:12AM

Re: listen proxy_protocol and rewrite redirect scheme

Francis Daly September 16, 2016 02:48PM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 17, 2016 02:36AM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 17, 2016 03:11AM

Re: listen proxy_protocol and rewrite redirect scheme

Francis Daly September 17, 2016 08:12AM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 17, 2016 09:25AM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 17, 2016 11:24AM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 17, 2016 12:05PM

Re: listen proxy_protocol and rewrite redirect scheme

Francis Daly September 17, 2016 08:24AM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 17, 2016 01:42PM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 17, 2016 01:51PM

Re: listen proxy_protocol and rewrite redirect scheme

Francis Daly September 20, 2016 03:38PM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 21, 2016 03:25AM

Re: listen proxy_protocol and rewrite redirect scheme

Francis Daly September 21, 2016 12:44PM

Re: listen proxy_protocol and rewrite redirect scheme

adrhc September 22, 2016 07:57AM

Re: listen proxy_protocol and rewrite redirect scheme

Francis Daly September 25, 2016 04:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
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