# SPDY: nginx/1.6.2: proxy\_pass does not work when https is used

**URL:** <https://www.ruby-forum.com/t/spdy-nginx-1-6-2-proxy-pass-does-not-work-when-https-is-used/233461>\
**Category:** NGINX\
**Created:** [December 15, 2014, 9:05pm UTC](https://www.ruby-forum.com/t/spdy-nginx-1-6-2-proxy-pass-does-not-work-when-https-is-used/233461 "2014-12-15T21:05:35Z")\
**Posts on this page:** 5\
**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:** [December 15, 2014, 9:05pm UTC](https://www.ruby-forum.com/t/spdy-nginx-1-6-2-proxy-pass-does-not-work-when-https-is-used/233461/1 "2014-12-15T21:05:35Z")

</div>

Hi,

I’ve got a problem when tried to proxy spdy traffic to host via https  
protocol.

My config is simple like that:

location /https/test {

```
proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host;

proxy_pass https://www.something.com/test;

```

}

When request is performed through HTTP protocol, everything works fine  
without any problem.

However, when incoming request is done through SPDY, there is no  
response  
from remote peer in about 10 seconds and connection is closed after that  
by  
client.

As a short term solution, I’ve found the following workaround in order  
to  
resolve the problem:

location /https/test {

```
proxy_set_header X-Real-IP $remote_addr;

proxy_set_header Host $host;

proxy_pass http://localhost/internal/https/test;

```

}

location /internal/https/test {

```
proxy_set_header X-Real-IP $remote_addr;

proxy_pass https://www.something.com/test;

```

}

However, in a long term, it would be great to have this problem fixed in  
nginx and avoid any workaround in config files.

BR/ Yury

---

<div class="post-metadata">

**Author:** ![Yury\_Kirpichev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/c0e974/32.png) [@Yury\_Kirpichev](https://www.ruby-forum.com/u/Yury_Kirpichev)\
**Post date:** [December 16, 2014, 1:18am UTC](https://www.ruby-forum.com/t/spdy-nginx-1-6-2-proxy-pass-does-not-work-when-https-is-used/233461/2 "2014-12-16T01:18:33Z")

</div>

On Tuesday 16 December 2014 00:05:03 Yury Kirpichev wrote:

> ```
> proxy_set_header X-Real-IP $remote_addr;
> 
> ```
> 
> However, when incoming request is done through SPDY, there is no response  
> from remote peer in about 10 seconds and connection is closed after that by  
> client.  
> [..]

I can’t reproduce the problem with your simple config.  
It just works in both cases with or w/o SPDY.

Could you please provide more information like “nginx -V” output  
and debug log: [A debugging log](http://nginx.org/en/docs/debugging_log.html)

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![Yury\_Kirpichev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/c0e974/32.png) [@Yury\_Kirpichev](https://www.ruby-forum.com/u/Yury_Kirpichev)\
**Post date:** [December 16, 2014, 2:18am UTC](https://www.ruby-forum.com/t/spdy-nginx-1-6-2-proxy-pass-does-not-work-when-https-is-used/233461/3 "2014-12-16T02:18:01Z")

</div>

On 2014-12-15, 4:18 PM, Valentin V. Bartenev wrote:

> > without any problem.  
> > and debug log: [A debugging log](http://nginx.org/en/docs/debugging_log.html)
> 
> wbr, Valentin V. Bartenev
> 
> * * *
> 
> 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)  
> Can you provide logs please? can you see that the connection is being  
> processed by https and packets sent to the remote host? is your local  
> system setup with proper dns (if you are using a hostname)… firewall,  
> anything in your hostdeny?

---

<div class="post-metadata">

**Author:** ![Yury\_Kirpichev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/c0e974/32.png) [@Yury\_Kirpichev](https://www.ruby-forum.com/u/Yury_Kirpichev)\
**Post date:** [December 16, 2014, 9:49am UTC](https://www.ruby-forum.com/t/spdy-nginx-1-6-2-proxy-pass-does-not-work-when-https-is-used/233461/4 "2014-12-16T09:49:20Z")

</div>

Hi,

Here is full config, I tried to make it as small as possible.

worker\_processes 12;

events {  
worker\_connections 8192;  
use epoll;  
}

http {  
server {  
listen [::]:6121 spdy;  
listen [::]:80;

```
    client_body_buffer_size 100k;
    client_max_body_size 100k;

    server_name *.maps.dev.yandex.net;

    location /https/test {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_pass https://www.google.com/test;
    }
}

```

}

Also, I’ve found that if I comment out line with worker\_processes then  
problem will disappear.

Here is output from /usr/sbin/nginx -V  
nginx version: nginx/1.6.2  
TLS SNI support enabled  
configure arguments: --prefix=/etc/nginx  
–conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log  
–http-client-body-temp-path=/var/lib/nginx/body  
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi  
–http-log-path=/var/log/nginx/access.log  
–http-proxy-temp-path=/var/lib/nginx/proxy  
–http-scgi-temp-path=/var/lib/nginx/scgi  
–http-uwsgi-temp-path=/var/lib/nginx/uwsgi  
–lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid  
–with-debug  
–with-http\_addition\_module --with-http\_flv\_module  
–with-http\_dav\_module  
–with-http\_geoip\_module --with-http\_gzip\_static\_module  
–with-http\_gunzip\_module --with-http\_image\_filter\_module  
–with-http\_perl\_module --with-http\_realip\_module  
–with-http\_stub\_status\_module --with-http\_ssl\_module  
–with-http\_spdy\_module --with-http\_sub\_module --with-http\_xslt\_module  
–with-ipv6 --with-sha1=/usr/include/openssl  
–with-md5=/usr/include/openssl --with-mail --with-mail\_ssl\_module  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-echo  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-headers-more  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-development-kit  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-lua  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-upstream-fair  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-flv-filter  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-ip-tos-filter  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-addtag-exe  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-speedtest  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-eblob  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-request-id  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-favicon  
–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-auth-sign

Unfortunately, I can not collect debug logs right now.  
However, I did captured tcpdump on server with nginx and was able to see  
that nginx established SSL connection with [google.com](http://google.com), however, after  
that  
it got stuck somewhere (can provide logs if you need it)

BR/ Yury

2014-12-16 3:18 GMT+03:00 Valentin V. Bartenev [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Yury\_Kirpichev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/c0e974/32.png) [@Yury\_Kirpichev](https://www.ruby-forum.com/u/Yury_Kirpichev)\
**Post date:** [December 16, 2014, 11:10am UTC](https://www.ruby-forum.com/t/spdy-nginx-1-6-2-proxy-pass-does-not-work-when-https-is-used/233461/5 "2014-12-16T11:10:00Z")

</div>

On Tuesday 16 December 2014 11:48:37 Yury Kirpichev wrote:

> ```
> listen [::]:80;
> }
> }
> 
> ```
> 
> }

I’ve tested exactly with this config and see no problem:

% ./spdycat --spdy3-1 --no-tls ‘http://[::1]:6121/https/test’ -v  
[0.000] Handshake complete  
[0.000] send SYN\_STREAM frame \<version=3, flags=1, length=222\>  
(stream\_id=1, assoc\_stream\_id=0, pri=3)  
:host: [::1]:6121  
:method: GET  
:path: /https/test  
:scheme: http  
:version: HTTP/1.1  
accept: _/_  
accept-encoding: gzip, deflate  
user-agent: spdylay/1.2.3  
[0.001] recv SETTINGS frame \<version=3, flags=1, length=20\>  
(niv=2)  
[4(0):100]  
[7(0):2147483647]  
[0.001] recv WINDOW\_UPDATE frame \<version=3, flags=0, length=8\>  
(stream\_id=0, delta\_window\_size=2147418111)  
[0.459] recv SYN\_REPLY frame \<version=3, flags=0, length=212\>  
(stream\_id=1)  
:status: 404 Not Found  
:version: HTTP/1.1  
content-length: 1429  
content-type: text/html; charset=UTF-8  
date: Tue, 16 Dec 2014 09:59:46 GMT  
server: nginx/1.6.2

 Error 404 (Not Found)!!1 \*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}\* \> body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo\_sm\_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo\_sm\_2\_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo\_sm\_2\_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo\_sm\_2\_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px} 

**404.** That’s an error.

The requested URL `/test` was not found on this server. That’s all we know. [0.459] recv DATA frame (stream\_id=1, flags=1, length=1429) [0.459] send GOAWAY frame (last\_good\_stream\_id=0)

> –http-fastcgi-temp-path=/var/lib/nginx/fastcgi  
> –with-http\_spdy\_module --with-http\_sub\_module --with-http\_xslt\_module

–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-speedtest

> 

–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-eblob

> 

–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-request-id

> 

–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-favicon

> 

–add-module=/home/buildfarm/teamcity/projects/nginx-stable/debian/modules/nginx-auth-sign

> 

The problem can be in one of these 3-rd party modules.  
You should try without them first.

wbr, Valentin V. Bartenev
