Websockets behind Apache and Nginx proxy, Connection and Upgrade headers not present

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a problem. Apache listens on a white ip and proxies all requests /ssd on nginx that proxies requests /city-dashboard to another server with websockets.

Apache default.conf:

ProxyRequests On ProxyPreserveHost On <Location /test> ProxyPass "https://127.0.0.1:443" ProxyPassReverse "https://127.0.0.1:443" Allow from All Header set Connection "upgrade" Header set Upgrade "websocket" </Location>

nginx.conf:

map $http_upgrade $connection_upgrade { default upgrade; '' close; } map $http_sec_websocket_key $upgr { "" ""; # If the Sec-Websocket-Key header is empty, send no upgrade header default "websocket"; # If the header is present, set Upgrade to "websocket" } map $http_sec_websocket_key $conn { "" $http_connection; # If no Sec-Websocket-Key header exists, set $conn to the incoming Connection header default "upgrade"; # Otherwise, set $conn to upgrade } include /etc/nginx/conf.d/*.conf;

nginx default.conf:
location /city-dashboard { rewrite ^/city-dashboard\/(.*)$ /$1 break; proxy_pass http://127.0.0.1:5001; proxy_set_header Host $host; proxy_http_version 1.1; proxy_set_header Upgrade $upgr; proxy_set_header Connection "Upgrade\n\r"; proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key; proxy_read_timeout 100; proxy_redirect off; proxy_set_header X-Forwarded-Proto $scheme; add_header Front-End-Https on; }

Request headers:

GET wss://example.com:4443/test/city-dashboard/stream HTTP/1.1 Host: example.com:4443 Connection: Upgrade Pragma: no-cache Cache-Control: no-cache Upgrade: websocket Origin: https://example.com:4443 Sec-WebSocket-Version: 13 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36 Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8 Sec-WebSocket-Key: RlhNyYNipJ1RUOU7nl4xMA== Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

Response headers:

HTTP/1.1 101 Switching Protocols Server: nginx/1.8.0 Date: Sat, 22 Aug 2015 10:05:02 GMT Sec-WebSocket-Accept: e7UKY/y5mIi8RTmhLQgFJ566dfo=

Response header lacks Upgrade and Connection, if done on site management with nginx, I get an error 400 and websockets still does not work out. Remove the chain Apache does not work, because it is at another organization. Can someone with such experienced and offer some workarounds? or just have some decisions to make it work.


Regards, 
Nikolay Yakubitskiy
steseagal87@xxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux