Configuring a reverse proxy

StackState makes heavy use of Websockets, so when setting up a reverse proxy to make StackState available on, for example, port 80 or 443 (with TLS) you will also need to proxy Websocket requests. An example setup for Nginx for this looks like this (proxying port 80 to StackState running on localhost port 7070):

  http {
      map $http_upgrade $connection_upgrade {
          default upgrade;
          '' close;
      }

      server {
          listen 80;
          location / {
              proxy_pass http://127.0.0.1:7070;
              proxy_http_version 1.1;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection $connection_upgrade;
          }
      }
  }