-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
89 lines (76 loc) · 2.76 KB
/
nginx.conf
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
80
81
82
83
84
85
86
87
88
89
worker_processes auto;
user www-data;
events {
use epoll;
worker_connections 16;
}
http {
include mime.types;
server {
listen 80;
root /www/data;
location / {
alias /www/data/;
try_files $uri @index;
}
location @index {
add_header Cache-Control no-cache;
expires 0;
try_files /index.html =404;
}
location /files {
proxy_pass http://tusd:1080;
proxy_request_buffering off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $http_scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 0;
proxy_hide_header Access-Control-Allow-Origin;
add_header Access-Control-Allow-Origin * always;
}
location /media/ {
types {
video/mkv mkv;
}
sendfile on;
alias /www/media/;
try_files $uri =404;
}
location /api/ {
add_header 'Access-Control-Allow-Origin' '*' always;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Content-Length' 0;
# add_header 'Content-Type' 'text/plain; charset=utf-8';
return 204;
}
# http_host can be a security issue for some apps, but in this
# case all you could do is make your own browser use the wrong
# URL
proxy_set_header Host $http_host;
proxy_set_header Scheme $http_scheme;
proxy_pass http://api:8080/;
}
location /api/events/ {
proxy_pass http://api:8080/events/;
# add_header 'Access-Control-Allow-Origin' '*' always;
proxy_http_version 1.1;
proxy_read_timeout 300s;
### Client should send correct headers
# proxy_set_header Connection '';
### API should send correct headers
# add_header Connection 'keep-alive';
# chunked_transfer_encoding off;
# proxy_buffering off;
# proxy_cache off;
}
# location /transmission {
# proxy_pass http://transmission:9091/transmission;
# }
}
}