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:
parent
b100b26b77
commit
0178cc9cb5
2 changed files with 13 additions and 8 deletions
|
@ -22,17 +22,17 @@ location __PATH__/ {
|
||||||
return 204;
|
return 204;
|
||||||
}
|
}
|
||||||
if ($request_method = 'POST') {
|
if ($request_method = 'POST') {
|
||||||
more_set_headers "Access-Control-Allow-Origin: * always";
|
more_set_headers "Access-Control-Allow-Origin: *";
|
||||||
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS always";
|
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 always";
|
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 always";
|
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request_method = 'GET') {
|
if ($request_method = 'GET') {
|
||||||
more_set_headers "Access-Control-Allow-Origin: * always";
|
more_set_headers "Access-Control-Allow-Origin: *";
|
||||||
more_set_headers "Access-Control-Allow-Methods: GET, POST, OPTIONS always";
|
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 always";
|
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 always";
|
more_set_headers "Access-Control-Expose-Headers: Content-Length,Content-Range";
|
||||||
}
|
}
|
||||||
|
|
||||||
# this is needed if you have file import via upload enabled
|
# this is needed if you have file import via upload enabled
|
||||||
|
|
|
@ -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
|
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
|
StandardOutput=syslog
|
||||||
StandardError=syslog
|
StandardError=syslog
|
||||||
SyslogIdentifier=__APP__-server
|
SyslogIdentifier=__APP__-server
|
||||||
|
|
Loading…
Add table
Reference in a new issue