-
-
Notifications
You must be signed in to change notification settings - Fork 418
Setup behind Reverse Proxies
Vasyl Ostrovskyi edited this page Oct 12, 2020
·
6 revisions
WBO is served at the domain root. If you want to serve it at a different location you can do so by using a reverse proxy. Below are two example configurations for nginx and Apache, assuming you run wbo on localhost
on port 5001 and want to expose it at /wbo
.
First, you'll need to enable some apache modules :
sudo a2enmod rewrite proxy proxy_wstunnel proxy_http
Then add the following to your apache configuration, in
/etc/apache2/sites-enabled/yoursite.conf
:
<Proxy http://localhost:5001>
Allow from all
</Proxy>
RedirectMatch ^/wbo$ /wbo/
RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /wbo/(.*) ws://localhost:5001/$1 [P,L]
ProxyPass /wbo/ http://localhost:5001/
ProxyPassReverse /wbo/ http://localhost:5001/
proxy_headers.conf:
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
Add this to your nginx.conf in the server block you want to use.
location /wbo {
include proxy_headers.conf;
rewrite ^/wbo/(.*) /$1 break;
proxy_pass http://localhost:5001/;
}
location /wbo/socket.io {
include proxy_headers.conf;
proxy_pass http://localhost:5001/socket.io;
}