-
Notifications
You must be signed in to change notification settings - Fork 51
/
tenant-proxy.conf.template
89 lines (71 loc) · 2.68 KB
/
tenant-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
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
server {
listen *:8080;
listen [::]:8080;
server_name localhost;
# set default headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_buffering off;
# =============================================
# Block list
# =============================================
location /multitenancy {
deny all;
}
location /shutdown {
deny all;
}
location /status {
deny all;
}
# =============================================
# Block list exceptions
# =============================================
location ~ ^/multitenancy/(wallet|tenant)/([0-9a-zA-Z/-]+)/token$ {
try_files $uri $uri/ @proxy;
}
location ~ ^/multitenancy/reservations(/[0-9a-zA-Z-]*/?)?(check-in)?$ {
try_files $uri $uri/ @proxy;
}
location ~ ^/status/(live|ready)$ {
try_files $uri $uri/ @proxy;
}
# =============================================
# Everything else
# =============================================
location / {
try_files $uri $uri/ @proxy;
}
location @proxy {
proxy_set_header X-API-KEY ${ACAPY_ADMIN_URL_API_KEY};
proxy_pass ${ACAPY_ADMIN_URL};
allow all;
proxy_set_header 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 $scheme;
proxy_hide_header Access-Control-Allow-Origin;
proxy_hide_header Access-Control-Allow-Credentials;
set $CORS_CREDS true;
set $CORS_ORIGIN $http_origin;
set $CORS_PREFLIGHT_CACHE_AGE 600;
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin $CORS_ORIGIN always ;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE';
add_header Access-Control-Allow-Headers $http_access_control_request_headers;
add_header Access-Control-Allow-Credentials $CORS_CREDS always ;
add_header Access-Control-Max-Age $CORS_PREFLIGHT_CACHE_AGE;
add_header Content-Type 'text/plain; charset=utf-8';
add_header Content-Length 0;
return 204;
}
if ($request_method != 'OPTIONS') {
add_header Access-Control-Allow-Origin $CORS_ORIGIN always ;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE';
add_header Access-Control-Allow-Headers $http_access_control_request_headers;
add_header Access-Control-Allow-Credentials $CORS_CREDS always ;
}
}
}