Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


Any idea?


share|improve this question

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


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.