Sto provando a proxy WebSocket + traffico HTTP con nginx.nginx e proxy WebSocket
Ho letto questo: http://nginx.org/en/docs/http/websocket.html
mio config si presenta come:
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name ourapp.com;
location/{
proxy_pass http://127.0.0.1:100;
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
ho 2 problemi:
1) Il collegamento si chiude una volta al minuto.
2) Voglio eseguire sia HTTP che WS sulla stessa porta. L'applicazione funziona bene a livello locale, ma se provo a mettere HTTP e WS sulla stessa porta e impostare questo proxy nginx, ottengo questo:
collegamento WebSocket a 'WS: //ourapp.com/ws' fallito : Codice di risposta inatteso: 200
Il caricamento dell'applicazione (HTTP) sembra funzionare correttamente, ma la connessione WebSocket non riesce.