Forum: NGINX HTTPS header missing from single server

Posted by Grant (Guest)
on 2013-03-10 06:51
(Received via mailing list)
How can I make nginx set the HTTPS header in a single http/https
server?  piwik with force_ssl=1 on apache goes into a redirect loop
because it doesn't know SSL is on due to the nginx reverse proxy.
There is a piwik bug which references a similar problem and blames the
HTTPS header:

http://dev.piwik.org/trac/ticket/2073

- Grant
Posted by Francis Daly (Guest)
on 2013-03-10 11:41
(Received via mailing list)
On Sat, Mar 09, 2013 at 09:51:02PM -0800, Grant wrote:

Hi there,

> How can I make nginx set the HTTPS header in a single http/https
> server?

What is "the HTTPS header"?

> piwik with force_ssl=1 on apache goes into a redirect loop
> because it doesn't know SSL is on due to the nginx reverse proxy.

This sounds like one or more fastcgi_param key/value pairs are not set
the way your application wants them to be set.

http://nginx.org/r/fastcgi_param is how you set them. And it
includes an example with the $https variable, which is described in
http://nginx.org/en/docs/http/ngx_http_core_module...

The usual nginx directive inheritance rules apply, so you'll want to add
your fastcgi_param line to the correct place -- possibly just after you
include the external file.

  f
--
Francis Daly        francis@daoine.org
Posted by Grant (Guest)
on 2013-03-10 23:25
(Received via mailing list)
>> How can I make nginx set the HTTPS header in a single http/https
>> server?
>
> What is "the HTTPS header"?

I meant to say HTTPS environment variable.

>> piwik with force_ssl=1 on apache goes into a redirect loop
>> because it doesn't know SSL is on due to the nginx reverse proxy.
>
> This sounds like one or more fastcgi_param key/value pairs are not set
> the way your application wants them to be set.
>
> http://nginx.org/r/fastcgi_param is how you set them. And it
> includes an example with the $https variable, which is described in
> http://nginx.org/en/docs/http/ngx_http_core_module...

I should have mentioned that I'm using proxy_pass.  I was able to get
it working like this:

proxy_set_header X-Forwarded-Proto $scheme;

- Grant
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.