mirror of
https://github.com/CyberMind-FR/secubox-deb.git
synced 2026-07-29 12:34:38 +00:00
30s was too short for slow module operations behind the reverse proxy — a podcaster audiobook upload (server-side ZIP extraction of ~120MB) exceeded it, so nginx returned 502 on an upload that actually succeeded. 300s matches the per-vhost timeouts already used elsewhere (lyrion, yacy). Applies to every module served through secubox.d. Co-Authored-By: Gerald KERMA <devel@cybermind.fr>
47 lines
1.8 KiB
Plaintext
47 lines
1.8 KiB
Plaintext
# /etc/nginx/snippets/secubox-proxy.conf
|
|
# Paramètres communs pour tous les proxies vers les sockets Unix SecuBox
|
|
|
|
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_set_header Connection "";
|
|
|
|
proxy_read_timeout 300s;
|
|
proxy_connect_timeout 5s;
|
|
proxy_send_timeout 30s;
|
|
|
|
proxy_buffering off;
|
|
proxy_cache off;
|
|
|
|
# Passer le header Authorization pour JWT
|
|
proxy_set_header Authorization $http_authorization;
|
|
|
|
# Some upstream FastAPI services also emit CORS headers via CORSMiddleware.
|
|
# Strip them here so nginx is the sole authority — otherwise browsers see
|
|
# `Access-Control-Allow-Origin: *, *` and reject cross-origin requests.
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
proxy_hide_header Access-Control-Allow-Methods;
|
|
proxy_hide_header Access-Control-Allow-Headers;
|
|
proxy_hide_header Access-Control-Allow-Credentials;
|
|
proxy_hide_header Access-Control-Max-Age;
|
|
proxy_hide_header Access-Control-Expose-Headers;
|
|
|
|
# CORS headers for cross-origin requests
|
|
add_header Access-Control-Allow-Origin '*' always;
|
|
add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS' always;
|
|
add_header Access-Control-Allow-Headers 'Authorization, Content-Type, Accept' always;
|
|
add_header Access-Control-Max-Age 86400 always;
|
|
|
|
# Handle preflight OPTIONS requests
|
|
if ($request_method = 'OPTIONS') {
|
|
add_header Access-Control-Allow-Origin '*';
|
|
add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
|
|
add_header Access-Control-Allow-Headers 'Authorization, Content-Type, Accept';
|
|
add_header Access-Control-Max-Age 86400;
|
|
add_header Content-Length 0;
|
|
add_header Content-Type text/plain;
|
|
return 204;
|
|
}
|