# Using SNI to route proxy\_pass to upstream SSL host

**URL:** <https://www.ruby-forum.com/t/using-sni-to-route-proxy-pass-to-upstream-ssl-host/235462>\
**Category:** NGINX\
**Created:** [June 23, 2013, 5:36am UTC](https://www.ruby-forum.com/t/using-sni-to-route-proxy-pass-to-upstream-ssl-host/235462 "2013-06-23T05:36:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [June 23, 2013, 5:36am UTC](https://www.ruby-forum.com/t/using-sni-to-route-proxy-pass-to-upstream-ssl-host/235462/1 "2013-06-23T05:36:36Z")

</div>

Hey guys,

I am trying to get the following setup running:  
Nginx is listening to port 443. According to the users host (SNI), it  
should route the SSL requests to a upstream daemon / host which will  
take care of SSL certification, handshake and so on.

Nginx should not touch the request, just pass it.  
Since SSL also encrypts the header, it makes this setup a little bit  
more difficult than expected. A hint on serverfault indicated that SNI  
might be useful for this?

My current experiment:

server { listen 443; server\_name [example01.com](http://example01.com); location / {  
proxy\_set\_header Host $http\_host; proxy\_pass [https://127.0.0.1:8001](https://127.0.0.1:8001); } }  
server { listen 443; server\_name [example02.com](http://example02.com); location / {  
proxy\_set\_header Host $http\_host; proxy\_pass [https://127.0.0.1:8002](https://127.0.0.1:8002); } }  
server { listen 443; server\_name [example03.com](http://example03.com); location / {  
proxy\_set\_header Host $http\_host; proxy\_pass [https://127.0.0.1:8003](https://127.0.0.1:8003); } }  
server { listen 443; server\_name [example04.com](http://example04.com); location / {  
proxy\_set\_header Host $http\_host; proxy\_pass [https://127.0.0.1:8004](https://127.0.0.1:8004); } }

However, this doesn’t seem to work.

Any ideas on this?

Cheers,  
David
