-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy.conf.template
44 lines (37 loc) · 1.04 KB
/
proxy.conf.template
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
map $http_x_forwarded_proto $real_scheme {
default $http_x_forwarded_proto;
'' $scheme;
}
map $http_x_forwarded_prefix $real_path {
default $http_x_forwarded_prefix;
'' '';
}
map $http_x_forwarded_port $real_port {
default ":$http_x_forwarded_port";
80 "";
443 "";
'' "";
}
server {
listen 80;
server_name _;
resolver ${DNS_RESOLVER} valid=90s;
# this forces re-resolution of the dns name
set $backend "https://${WUNDER_BACKEND_HOST}/rest/gbfs$request_uri";
location / {
proxy_pass $backend;
proxy_set_header Authorization "Bearer ${WUNDER_API_TOKEN}";
proxy_set_header Cookie "";
proxy_set_header X-Forwarded-Proto "";
proxy_set_header X-Forwarded-Host "";
proxy_set_header X-Forwarded-Port "";
proxy_set_header X-Forwarded-Prefix "";
proxy_hide_header Set-Cookie;
sub_filter_types text/json application/json;
sub_filter "https://${WUNDER_BACKEND_HOST}/rest/gbfs" "$real_scheme://$host$real_port$real_path";
sub_filter_once off;
}
location = / {
return 301 "$real_scheme://$host$real_port$real_path/gbfs.json";
}
}