-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttp.conf
More file actions
79 lines (60 loc) · 2.54 KB
/
http.conf
File metadata and controls
79 lines (60 loc) · 2.54 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
server {
server_name discosat.cs.uni-kl.de;
client_max_body_size 4G;
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/|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://127.0.0.1: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='";
}
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/discosat.cs.uni-kl.de/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/discosat.cs.uni-kl.de/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream uvicorn {
server unix:/tmp/uvicorn.sock;
}
server {
if ($host = discosat.cs.uni-kl.de) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name discosat.cs.uni-kl.de;
return 404; # managed by Certbot
}