Incorrect redirect protocol when behind a reverse proxy

Glenn Maynard glenn at
Wed Jul 24 22:03:38 UTC 2013

Our nginx server is running on Heroku, which proxies SSL.  This mostly
works fine, but nginx has one problem with it: since it thinks the protocol
is http, any redirects (such as trailing-slash redirects) go to http
instead of https.

The usual fix for this is X-Forwarded-Proto, but nginx doesn't support that
yet, and I haven't found any way to configure it, eg. a configuration
directive to override the protocol.  Nginx seems to decide whether
redirects should go to http or https entirely based on whether the
connection has an SSL context associated (ngx_http_header_filter), so it
doesn't look like there's any way to affect this in configuration.

Is there any workaround?

Glenn Maynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list