# $https with SSL proxy

**URL:** <https://www.ruby-forum.com/t/https-with-ssl-proxy/218483>\
**Category:** NGINX\
**Created:** [April 2, 2012, 9:50am UTC](https://www.ruby-forum.com/t/https-with-ssl-proxy/218483 "2012-04-02T09:50:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [April 2, 2012, 9:50am UTC](https://www.ruby-forum.com/t/https-with-ssl-proxy/218483/1 "2012-04-02T09:50:59Z")

</div>

Dear all,

starting with version 1.1.11 the $https variable is activated by  
default. This is good as many applications rely on them because apache  
is using this header.  
However, now i cannot set or map this variable (nginx: [emerg] the  
duplicate “https” variable). We have a load balancer in front of the web  
servers which does all SSL traffic. The nginx servers can only differ  
between http and https via a header sent by the load balancer, the nginx  
port is the same. That hasn’t been a problem in \< 1.1.11. Many plugins,  
codings in applications use this $https header so it would be nice if i  
could assign it manually.

Any ideas?

Thanks.

Posted at Nginx Forum:

> **[$https with SSL proxy](https://forum.nginx.org/read.php?2,224756,224756#msg-224756)**
>
> Dear all, starting with version 1.1.11 the $https variable is activated by default. This is good as many applications rely on them because apache is using this header. However, now i cannot set or map this variable (nginx: \[emerg\] the duplicate...

---

<div class="post-metadata">

**Author:** ![mscheel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mscheel](https://www.ruby-forum.com/u/mscheel)\
**Post date:** [April 2, 2012, 10:00am UTC](https://www.ruby-forum.com/t/https-with-ssl-proxy/218483/2 "2012-04-02T10:00:54Z")

</div>

> codings in applications use this $https header so it would be nice if i  
> could assign it manually.

Have you tried explicitly setting the fastcgi\_param, like in:

fastcgi\_param HTTPS $my\_https;

where $my\_https is a variable that you set as you want it?

–appa

---

<div class="post-metadata">

**Author:** ![mscheel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mscheel](https://www.ruby-forum.com/u/mscheel)\
**Post date:** [April 2, 2012, 10:05am UTC](https://www.ruby-forum.com/t/https-with-ssl-proxy/218483/3 "2012-04-02T10:05:52Z")

</div>

## Antonio P.P. Almeida Wrote:

> balancer in front of the web  
> Have you tried explicitly setting the  
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

The problem is that all applications rely on this “https” header,  
changing the code of all applications makes no sense to me.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,224756,224758#msg-224758](http://forum.nginx.org/read.php?2,224756,224758#msg-224758)

---

<div class="post-metadata">

**Author:** ![mscheel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mscheel](https://www.ruby-forum.com/u/mscheel)\
**Post date:** [April 2, 2012, 10:11am UTC](https://www.ruby-forum.com/t/https-with-ssl-proxy/218483/4 "2012-04-02T10:11:28Z")

</div>

> The problem is that all applications rely on this “https” header,  
> changing the code of all applications makes no sense to me.

AFAIK it’s not a header but rather a parameter that is passed through  
CGI  
and in PHP, for example, you recover via $\_SERVER[‘HTTPS’]. This has  
nothing to do with headers. Of course you can set a header based on it.

X-Forwarded-Proto $https;

or

X-Forwarded-Proto $my\_https;

—appa

---

<div class="post-metadata">

**Author:** ![mscheel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mscheel](https://www.ruby-forum.com/u/mscheel)\
**Post date:** [April 2, 2012, 10:36am UTC](https://www.ruby-forum.com/t/https-with-ssl-proxy/218483/5 "2012-04-02T10:36:22Z")

</div>

> X-Forwarded-Proto $my\_https;

Oops. My bad. I meant:

X-Forwarded-Proto $scheme;

–appa

---

<div class="post-metadata">

**Author:** ![mscheel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mscheel](https://www.ruby-forum.com/u/mscheel)\
**Post date:** [April 2, 2012, 10:40am UTC](https://www.ruby-forum.com/t/https-with-ssl-proxy/218483/6 "2012-04-02T10:40:43Z")

</div>

Your right, setting it for fastcgi as param works fine. I had a problem  
in the past setting variables in the fastcgi\_params, they’ve just been  
ignored. This seems to be gone.  
Then i have to rewrite the nginx internal logic of my  
substitions/mappings based on this variable.

I still think allowing a manual override of this variable should be  
allowed. If any other plugin relies on this header users with SSL  
Accelerators will definately have a problem.

Posted at Nginx Forum:

> **[Re: $https with SSL proxy](https://forum.nginx.org/read.php?2,224756,224761#msg-224761)**
>
> Dear all, starting with version 1.1.11 the $https variable is activated by default. This is good as many applications rely on them because apache is using this header. However, now i cannot set or map this variable (nginx: \[emerg\] the duplicate...
