2023-12-01 12:36:55 +01:00
|
|
|
# Redirect root path to the generated Swagger documentation page
|
|
|
|
location = __PATH__/ {
|
|
|
|
rewrite __PATH__/ __PATH__/docs;
|
|
|
|
}
|
2023-11-28 13:20:48 +01:00
|
|
|
|
2023-11-28 15:45:06 +01:00
|
|
|
location __PATH__/ {
|
2023-12-11 09:58:57 +01:00
|
|
|
# Wide-open CORS config for nginx
|
|
|
|
# From : https://enable-cors.org/server_nginx.html
|
|
|
|
if ($request_method = 'OPTIONS') {
|
2023-12-15 20:36:45 +01:00
|
|
|
more_set_headers "Access-Control-Allow-Origin: *";
|
|
|
|
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS";
|
2023-12-11 09:58:57 +01:00
|
|
|
#
|
|
|
|
# Custom headers and headers various browsers *should* be OK with but aren't
|
|
|
|
#
|
2023-12-15 23:04:10 +01:00
|
|
|
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";
|
2023-12-11 09:58:57 +01:00
|
|
|
#
|
|
|
|
# Tell client that this pre-flight info is valid for 20 days
|
|
|
|
#
|
2023-12-15 20:36:45 +01:00
|
|
|
more_set_headers "Access-Control-Max-Age: 1728000";
|
|
|
|
more_set_headers "Content-Type: text/plain; charset=utf-8";
|
|
|
|
more_set_headers "Content-Length: 0";
|
2023-12-11 09:58:57 +01:00
|
|
|
return 204;
|
|
|
|
}
|
2023-12-15 23:04:10 +01:00
|
|
|
if ($request_method = 'POST') {
|
|
|
|
more_set_headers "Access-Control-Allow-Origin: * always";
|
|
|
|
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS always";
|
|
|
|
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range always";
|
|
|
|
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range always";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_method = 'GET') {
|
2023-12-15 20:36:45 +01:00
|
|
|
more_set_headers "Access-Control-Allow-Origin: * always";
|
2023-12-15 20:44:19 +01:00
|
|
|
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS always";
|
2023-12-15 20:36:45 +01:00
|
|
|
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range always";
|
|
|
|
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range always";
|
2023-12-11 09:58:57 +01:00
|
|
|
}
|
2023-11-28 13:20:48 +01:00
|
|
|
|
2023-11-28 15:45:06 +01:00
|
|
|
# this is needed if you have file import via upload enabled
|
|
|
|
client_max_body_size 100M;
|
2023-11-28 13:20:48 +01:00
|
|
|
|
2023-12-11 09:58:57 +01:00
|
|
|
# Configuration to pass request to Gunicorn
|
|
|
|
# https://github.com/benoitc/gunicorn/blob/master/examples/nginx.conf
|
2023-11-28 15:45:06 +01:00
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Protocol $scheme;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Scheme $scheme;
|
2023-11-28 13:20:48 +01:00
|
|
|
|
2023-12-11 09:58:57 +01:00
|
|
|
# do not pass the CORS header from the response of the proxied server to the client
|
|
|
|
proxy_hide_header 'Access-Control-Allow-Origin';
|
|
|
|
|
2023-11-28 15:45:06 +01:00
|
|
|
proxy_read_timeout 30;
|
|
|
|
proxy_send_timeout 30;
|
|
|
|
proxy_connect_timeout 30;
|
|
|
|
proxy_redirect off;
|
2023-11-28 13:20:48 +01:00
|
|
|
|
2023-11-28 15:45:06 +01:00
|
|
|
proxy_pass http://127.0.0.1:__PORT__/;
|
2023-11-28 13:20:48 +01:00
|
|
|
}
|