Eu tenho um problema. O Apache atende em um ip branco e faz o proxy de todos os pedidos / ssd no nginx que enviam solicitações / city-dashboard para outro servidor com websockets. Na configuração do apache:
ProxyPass /ssd/ http://10.127.32.24
ProxyPassReverse /ssd/ http://10.127.32.24
nginx config: no nginx.conf:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
inclua /etc/nginx/conf.d/*.conf; no default.conf
location /city-dashboard/stream {
proxy_pass http://10.127.32.24:5000/stream;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
Solicitar cabeçalhos:
GET ws://x.x.x.x/ssd/city-dashboard/stream HTTP/1.1
Host: x.x.x.x
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: http://x.x.x.x
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Sec-WebSocket-Key: 881o9c/z3Q437JFCti3BIw==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Cabeçalhos de resposta:
Connection:Upgrade, close
Content-Length:34
Content-Type:text/html; charset=UTF-8
Date:Wed, 19 Aug 2015 16:53:40 GMT
Server:nginx/1.8.0
Upgrade:websocket
Connection: close
Código de status 400 Solicitação incorreta O que estou fazendo de errado? Acho que talvez o apache ou o nginx cortem os cabeçalhos, como fazer com que eles não o fizessem?
Eu tentei escrever assim no apache conf:
Header set Connection "Upgrade"
RequestHeader setifempty Connection "Upgrade"
Header set Upgrade "websocket"
RequestHeader setifempty Upgrade "websocket"