-
Notifications
You must be signed in to change notification settings - Fork 173
Using Flood behind a reverse proxy
In order to use Flood behind a reverse proxy, you must be sure to forward all requests to Flood's node server.
Often people want to expose multiple web applications with a single nginx config. This is possible using Flood's baseURI
option and nginx's proxy_pass
.
In the following configuration example, let's assume Flood is running at 127.0.0.1:3000
, and that you would like to serve Flood from nested route /flood
(e.g. https://some-domain.com/flood
).
Your nginx config should contain these rules:
location /flood/ {
proxy_pass http://127.0.0.1:3000/;
}
Your Flood config should contain the following value:
baseURI: '/flood'
Note: You must recompile static assets after changing the baseURI
configuration option.
Now, let's assume Flood is running at 127.0.0.1:3000
, and that you would like to serve Flood from the root (e.g. https://some-domain.com
).
Your nginx config should contain these rules:
location / {
proxy_pass http://127.0.0.1:3000;
}
And your Flood config should contain the following values:
baseURI: '/'
In both cases, in order to pass on the events from the event-stream, the request should not be buffered. You can disable buffering in nginx by adding these lines in your location
block:
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
Note that these are only strictly required for the event stream, so if it poses problems you can set it only for the /api/
location.