Re: listen proxy_protocol and rewrite redirect scheme

2016-09-25 Thread Francis Daly
On Thu, Sep 22, 2016 at 07:57:17AM -0400, adrhc wrote: Hi there, > I'm just a bit surprised that "port_in_redirect off" does not also > work. But that's ok -- I'm often surprised. > There's a "if" in src/http/ngx_http_header_filter_module.c which changes > port's value from 443 to 0 when on ssl

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-22 Thread adrhc
I'm just a bit surprised that "port_in_redirect off" does not also work. But that's ok -- I'm often surprised. There's a "if" in src/http/ngx_http_header_filter_module.c which changes port's value from 443 to 0 when on ssl + port initially 443 so https://adrhc.go.ro/ffp_0.7_armv5 would redirect to

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-21 Thread Francis Daly
On Wed, Sep 21, 2016 at 03:25:04AM -0400, adrhc wrote: Hi there, > Indeed the solution might look strange but it works (test it with e.g. https > or http ://adrhc.go.ro/ffp). It is good that it works. The http redirect there does not include the port; the https redirect does include the port,

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-21 Thread adrhc
Indeed the solution might look strange but it works (test it with e.g. https or http ://adrhc.go.ro/ffp). Would be nicer if would exists a variable like let's say $override_ssl which to force nginx consider it run a ssl request with all the consequences. Again I thank you for your support. Posted

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-20 Thread Francis Daly
On Sat, Sep 17, 2016 at 03:41:34PM -0400, adrhc wrote: Hi there, > The final working setup: > > src/http/ngx_http_header_filter_module.c: > #if (NGX_HTTP_SSL) > if (c->ssl || port == 443) { > *b->last++ ='s'; > } > #endif This will work in your circumstances -- you

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread adrhc
I'm sorry for the babble above but the source of errors are too many. The previous post the problem was php (e.g. phpMyAdmin). The final working setup: src/http/ngx_http_header_filter_module.c: #if (NGX_HTTP_SSL) if (c->ssl || port == 443) { *b->last++ ='s'; } #endif

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread adrhc
Hi, I'm sorry for the babble above but there are so many point of failure and the setup is so complex. Last problem was php (e.g. phpMyAdmin). Anyway now really works this way: src/http/ngx_http_header_filter_module.c: #if (NGX_HTTP_SSL) if (c->ssl || port == 443) { *b->last++ ='s'; }

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread adrhc
Hi, I'm sorry but I mistakenly claimed to work the patch: #if (NGX_HTTP_SSL) if (c->ssl || port == 443) { *b->last++ ='s'; } #endif In order to work nginx needs this config: server { listen 127.0.0.1:443proxy_protocol; port_in_redirect

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread adrhc
Hi, thank you for the hints. Starting from you suggestion I modified src/http/ngx_http_header_filter_module.c like this: #if (NGX_HTTP_SSL) if (c->ssl || port == 443) { *b->last++ ='s'; } #endif and it works! But works hand in hand with this nginx configuration (in

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread Francis Daly
On Sat, Sep 17, 2016 at 03:11:20AM -0400, adrhc wrote: Hi there, > Oh, and I only want this change to apply to servers with "listen ... > proxy_protocol" but not otherwise ... That makes the initial code-change suggestion (where *all* adjusted Location: headers would be https) insufficient. If

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread Francis Daly
On Sat, Sep 17, 2016 at 02:36:31AM -0400, adrhc wrote: Hi there, > yep, that's exactly my problem: > "... but that will not help internally-generated things like the > trailing-slash redirect for directories." > > I'll check your solution though I'm very open for other too :D If you care only

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread adrhc
Oh, and I only want this change to apply to servers with "listen ... proxy_protocol" but not otherwise ... Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269623,269640#msg-269640 ___ nginx mailing list nginx@nginx.org

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-17 Thread adrhc
yep, that's exactly my problem: "... but that will not help internally-generated things like the trailing-slash redirect for directories." I'll check your solution though I'm very open for other too :D PS: I do compile my own custom nginx Posted at Nginx Forum:

Re: listen proxy_protocol and rewrite redirect scheme

2016-09-16 Thread Francis Daly
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

listen proxy_protocol and rewrite redirect scheme

2016-09-16 Thread adrhc
Hi, I have this setup: 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