mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-27 17:37:18 +01:00
72 lines
2.1 KiB
Text
72 lines
2.1 KiB
Text
error_page 497 301 =307 https://$host:$server_port$request_uri;
|
|
|
|
# WebSocket authentication (includes rate limiting and network ACL)
|
|
include /etc/nginx/ws-auth.conf;
|
|
|
|
location /robots.txt {
|
|
return 200 "User-agent: *\nDisallow: /\n";
|
|
}
|
|
|
|
location /sitemap.xml {
|
|
return 200 "User-agent: *\nDisallow: /\n";
|
|
}
|
|
|
|
location /maintenance.html {
|
|
internal;
|
|
}
|
|
|
|
location /wss {
|
|
# Authenticate using JWT token
|
|
ws_auth;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
# WebSocket upgrade headers
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
# Forward real client information
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header X-Forwarded-Host $host;
|
|
proxy_set_header X-Forwarded-Server $host;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_pass http://127.0.0.1:9009;
|
|
|
|
# Disable buffering for real-time communication
|
|
proxy_buffering off;
|
|
|
|
# Timeouts for WebSocket (1 hour)
|
|
proxy_connect_timeout 3600;
|
|
proxy_send_timeout 3600;
|
|
proxy_read_timeout 3600;
|
|
}
|
|
|
|
location / {
|
|
autoindex on;
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range';
|
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
|
add_header 'Content-Length' 0;
|
|
return 204;
|
|
}
|
|
if ($request_method = 'GET') {
|
|
add_header 'Access-Control-Allow-Origin' '*' always;
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
|
}
|
|
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
|
add_header Pragma 'no-cache';
|
|
|
|
if (!-f $document_root/connection/ready) {
|
|
return 503;
|
|
}
|
|
|
|
expires 0;
|
|
}
|