Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to set the _SERVER["HTTPS"] php variable to yes on my web servers.

Actually, https trafic come to stunnel which forward it to haproxy which forward it to my web servers running under nginx.

Trying to add this in haproxy.cfg:

    reqidel ^HTTPS:
    reqadd HTTPS:\ yes

But instead of clear HTTPS and add HTTPS to yes it adds a new variable:

_SERVER["HTTP_HTTPS"]

Any idea?

Regards,

share|improve this question

1 Answer 1

I suspect you really need X-Forwarded-Proto instead. This header is a convention by which the reverse proxy can tell the origin server that a connection was HTTPS, even if the connection between reverse proxy and origin server is not. Most common web applications already check for this header, and you can easily check for it in a custom web app.

reqadd X-Forwarded-Proto:\ https if { ssl_fc }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.