July 30, 2013 05:28PM
On Thu, Jul 25, 2013 at 1:41 PM, Jonathan Matthews
<contact@jpluscplusm.com>wrote:

> I've just got to a box and can ACK that. I can make that stop with a
> correctly configured try_files, which I would always choose to have
> set up, myself. That may not be a solution for you however.
>
> Here's a way I've just tested (on 1.4.2) that forces the
> trailing-slash redirects to incorporate a random HTTP header ("foo",
> here) as their scheme:
>
> # include your boilerplate as per previous email
> location / {
> location ~ "^(.*)[^/]$" {
> rewrite ^ $http_foo://$http_host$uri/ permanent;
> }
> }
>
> Or, supposing you have certain URIs which *can* end in
> not-a-trailing-slash: (also tested on 1.4.2)
>
> location / {
> if (-d $document_root$uri) {
> rewrite ^ $http_foo://$http_host$uri/ permanent;
> }
> }
>
>

> I suppose the question is then: what *other* classes of automatic
> redirects do you find yourself hitting, and can you deterministically
> isolate their URIs using either a location{} or if{}, so that you can
> pre-empt the auto redirect in order to incorporate the
> X-forwarded-proto header?
>

Thanks, I'll give these approaches a try. I don't know where else this
might happen, though. Hopefully at some point I'll be able to say
something like "override_protocol $http_x_forwarded_proto;" to tell nginx
which protocol it's really receiving a request on, since SSL "offloading"
is fairly common these days (http://aws.amazon.com/elasticloadbalancing/,
etc).

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

Incorrect redirect protocol when behind a reverse proxy

glenn July 24, 2013 06:04PM

Re: Incorrect redirect protocol when behind a reverse proxy

Jonathan Matthews July 25, 2013 06:12AM

Re: Incorrect redirect protocol when behind a reverse proxy

glenn July 25, 2013 10:44AM

Re: Incorrect redirect protocol when behind a reverse proxy

Jonathan Matthews July 25, 2013 11:54AM

Re: Incorrect redirect protocol when behind a reverse proxy

glenn July 25, 2013 12:16PM

Re: Incorrect redirect protocol when behind a reverse proxy

Jonathan Matthews July 25, 2013 02:42PM

Re: Incorrect redirect protocol when behind a reverse proxy

glenn July 30, 2013 05:28PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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