Reverse proxy
A reverse proxy receives client requests and forwards them to STServer and the video, preview, and WebRTC services. Use it to provide one public address and HTTPS for a production deployment.
NGINX reverse proxy
The simplified Nginx example below forwards frontend and API requests to port 8080, WebRTC requests to port 8081, and video requests to port 8084. Adapt the service addresses to your deployment and add TLS configuration.
It routes requests as follows:\
- Forwards frontend and api requests to the server running on port 8080.
- Intercepts and forwards requests for video content to the video HTTP server running on port 8084.
server {
client_max_body_size 0; # to enable large video files upload
server_name stserver.mydomain.com;
# redirect from /webrtc → /webrtc/
location = /webrtc {
return 301 /webrtc/;
}
location ^~ /webrtc/ {
proxy_pass http://localhost:8081/;
proxy_redirect off;
proxy_http_version 1.1;
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 X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_request_buffering off;
}
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_read_timeout 360s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /videos/ {
proxy_pass http://localhost:8084;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
}