-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
default.conf.tpl
51 lines (45 loc) · 1.61 KB
/
default.conf.tpl
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
# Upstream
upstream backend {
server {{ .Env.FORWARD_HOST }}:{{ .Env.FORWARD_PORT }} max_fails=0;
}
# WS Handling
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# Server Definition
server {
listen {{ .Env.PORT }};
{{ if .Env.WEBSOCKET_PATH }}
location {{ .Env.WEBSOCKET_PATH }} {
proxy_pass http://backend{{ .Env.FORWARD_WEBSOCKET_PATH | default "" }};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_read_timeout {{ .Env.PROXY_READ_TIMEOUT }};
proxy_send_timeout {{ .Env.PROXY_SEND_TIMEOUT }};
}
{{ end }}
location / {
# Basic Auth
limit_except OPTIONS {
auth_basic "Restricted";
auth_basic_user_file "auth.htpasswd";
}
# Proxy
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_pass http://backend;
proxy_read_timeout {{ .Env.PROXY_READ_TIMEOUT }};
proxy_send_timeout {{ .Env.PROXY_SEND_TIMEOUT }};
client_max_body_size {{ .Env.CLIENT_MAX_BODY_SIZE }};
proxy_request_buffering {{ .Env.PROXY_REQUEST_BUFFERING }};
proxy_buffering {{ .Env.PROXY_BUFFERING }};
}
}