-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttp_dev.conf
More file actions
60 lines (49 loc) · 1.91 KB
/
http_dev.conf
File metadata and controls
60 lines (49 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
server {
listen 80;
server_name 127.0.0.1;
root /home/disco/discosat_server/app/static;
index index.html;
# protect cross-site-scripting
add_header Content-Security-Policy "script-src 'self'";
location / {
# path for static files
try_files $uri $uri/ =404;
}
# proxy all requests to /data, /docs or /jobs to FastAPI
location ~ ^/(data/|fixedjobs/|docs/|sensors/|login/|usermanagement/) {
proxy_set_header Access-Control-Origin *;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://0.0.0.0:8000;
}
# proxy dash requests to FastAPI and change Content-Security-Policy for scripts to hash of the dash generated
# inline script, so we dont have to use unsave-inline
location /dash/ {
proxy_set_header Access-Control-Origin *;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://127.0.0.1:8000;
# https://github.com/plotly/dash/issues/630 & https://github.com/plotly/dash-core-components/issues/752
add_header Content-Security-Policy "
script-src 'self' 'sha256-jZlsGVOhUAIcH+4PVs7QuGZkthRMgvT2n0ilH6/zTM0='
'sha256-nSprf64bZrwVRCJAphL0dHZeysya3zSu6qO7CSlTses=';
";
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream uvicorn {
server unix:/tmp/uvicorn.sock;
}