1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/FastAPI_ynh.git synced 2024-09-03 18:36:00 +02:00

fix nginx header to enable CORS + adding auto-restart in case on failure, such as Out Of Memory

This commit is contained in:
leonard 2024-04-08 14:38:15 +02:00 committed by Leonard
parent b100b26b77
commit 0178cc9cb5
2 changed files with 13 additions and 8 deletions

View file

@ -22,17 +22,17 @@ location __PATH__/ {
return 204;
}
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";
more_set_headers "Access-Control-Allow-Origin: *";
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS";
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range";
}
if ($request_method = 'GET') {
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";
more_set_headers "Access-Control-Allow-Origin: *";
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS";
more_set_headers "Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range";
}
# this is needed if you have file import via upload enabled

View file

@ -12,6 +12,11 @@ Environment="UVICORN_ROOT_PATH=__PATH__"
ExecStart=__INSTALL_DIR__/venv/bin/gunicorn --config __INSTALL_DIR__/gunicorn.conf.py FastAPIAppFolder:app --worker-class uvicorn.workers.UvicornWorker
Restart=on-failure
RestartSec=1s
StartLimitIntervalSec=60
StartLimitBurst=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=__APP__-server