-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnginx.conf
180 lines (140 loc) · 6.14 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
worker_processes 1;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
# set search paths for pure Lua external libraries (';;' is the default path):
lua_package_path '/usr/local/openresty/lualib/?.lua;;';
# cache for discovery metadata documents
lua_shared_dict discovery 1m;
# cache for JWKs
lua_shared_dict jwks 1m;
resolver 127.0.0.11;
index index.html index.htm;
server {
set $access_token '';
set $session_cookie_samesite off;
set $session_name compas_session;
listen 80 default_server;
listen [::]:80 default_server;
server_name reverse-proxy;
# set client body size to 150M #
client_max_body_size 150M;
# I disabled caching so the browser won't cache the site.
expires 0;
add_header Cache-Control private;
# Default forward all web calls to the OpenSCD Container
location / {
include /etc/nginx/include/authenticate.include;
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_set_header X-Forwarded-Port $server_port;
proxy_pass http://open-scd:8080/;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
# Forwarding to KeyCloak container.
location /auth/ {
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_set_header X-Forwarded-Port $server_port;
proxy_pass http://keycloak:8080/auth/;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
# Forwarding to the SCL Validator Service container (websockets).
location /compas-scl-data-service/scl-ws/ {
include /etc/nginx/include/authenticate.include;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header 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 $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Authorization "Bearer ${access_token}";
proxy_pass http://scl-data-service:8080/compas-scl-data-service/scl-ws/;
}
# Forwarding to the SCL Data Service container.
location /compas-scl-data-service/ {
include /etc/nginx/include/authenticate.include;
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_set_header X-Forwarded-Port $server_port;
proxy_set_header Authorization "Bearer ${access_token}";
proxy_pass http://scl-data-service:8080/compas-scl-data-service/;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
# Forwarding to the CIM Mapping Service container.
location /compas-cim-mapping/ {
include /etc/nginx/include/authenticate.include;
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_set_header X-Forwarded-Port $server_port;
proxy_set_header Authorization "Bearer ${access_token}";
proxy_pass http://cim-mapping:8080/compas-cim-mapping/;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
# Forwarding to the SCL Auto Alignment Service container.
location /compas-scl-auto-alignment/ {
include /etc/nginx/include/authenticate.include;
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_set_header X-Forwarded-Port $server_port;
proxy_set_header Authorization "Bearer ${access_token}";
proxy_pass http://scl-auto-alignment:8080/compas-scl-auto-alignment/;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
# Forwarding to the SCL Validator Service container (websockets).
location /compas-scl-validator/validate-ws/ {
include /etc/nginx/include/authenticate.include;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header 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 $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header Authorization "Bearer ${access_token}";
proxy_pass http://scl-validator:8080/compas-scl-validator/validate-ws/;
}
# Forwarding to the SCL Validator Service container (http).
location /compas-scl-validator/ {
include /etc/nginx/include/authenticate.include;
proxy_set_header Host $http_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_set_header X-Forwarded-Port $server_port;
proxy_set_header Authorization "Bearer ${access_token}";
proxy_pass http://scl-validator:8080/compas-scl-validator/;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
# redirect server error pages to the static page /40x.html
error_page 404 /404.html;
location = /40x.html {
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}