0

How is it possible to establish a websocket connection through nginx and apache, where both act as reverse proxies.

The system is setup with apache on the main host and a tornado webapplication in a container.

My apache config d is as follows:

<LocationMatch /container_path/(?<app>(.+))/ws >
        ProxyPass                       "ws://container_ip/app_name/%{env:MATCH_APP}/ws"
        ProxyPassReverseCookiePath      "/"  "/container_path/"

</LocationMatch>

My nginx config is something like the followed:

upstream backend {
        server 127.0.0.1:8888;
}

server {
    listen 80;


    location ~ /ws$ {

        proxy_pass http://backend;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

With this settings, I get a 400 Bad Request status from the WebSocketHandler of tornado.

Thx in advance for every hint

eatdas
  • 1
  • 1

0 Answers0