Using Nginx as reverse proxy
Here is a basic configuration that can be used to run STANAG On Demand Server microservices with a reverse proxy gateway.
server {
listen 80;
listen [::]:80;
server_name $SERVER_DOMAIN;
client_max_body_size 0;
location / {
proxy_pass http://localhost:$SERVER_PORT;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
location /videos/ {
gzip off;
gzip_static off;
proxy_buffering off;
tcp_nodelay On;
tcp_nopush On;
aio threads;
access_log off;
sendfile on;
sendfile_max_chunk 512k;
proxy_pass http://localhost:$VIDEO_SERVER_PORT/;
proxy_set_header Host $http_host;
}
location /supervisor/ {
proxy_pass http://localhost:$SUPERVISOR_PORT/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
location ~ /ws/(?<port>\d+) {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:$port/ws;
proxy_connect_timeout 1d;
proxy_send_timeout 1d;
proxy_read_timeout 1d;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}