-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathnginx.conf.conf
More file actions
173 lines (139 loc) · 4.64 KB
/
Copy pathnginx.conf.conf
File metadata and controls
173 lines (139 loc) · 4.64 KB
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
load_module /etc/nginx/modules/ngx_http_perl_module.so;
load_module /usr/lib/nginx/modules/ngx_http_subs_filter_module.so;
worker_processes 1;
events { worker_connections 1024; }
http {
# perl_modules perl/lib;
# Support replacing reference to altinn js and css in app with local hosted webpack dev server
perl_set $LOCAL_SUB_FILTER 'sub {
my $r = shift;
my $cookie = $r->header_in("cookie");
my $url = $1 if ($cookie =~ /.*frontendVersion=(http[^;]+)(;|$)/);
if($url)
{
$uri = $r->unescape($url);
return $uri;
}
return "";
}';
# If no cookie is set, bypass the sub_filter
perl_set $SUB_FILTER_BYPASS 'sub {
my $r = shift;
my $cookie = $r->header_in("cookie");
my $url = $1 if ($cookie =~ /.*frontendVersion=(http[^;]+)(;|$)/);
if($url)
{
return "0";
}
return "1";
}';
client_max_body_size 50M;
# Set timeout to 1 hour (helps when debugging)
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
proxy_read_timeout 3600;
send_timeout 3600;
sendfile on;
upstream localtest {
server ${INTERNAL_DOMAIN}:5101;
}
upstream app {
server ${HOST_DOMAIN}:5005;
}
# Redirect localhost and the old altinn3local.no to the configured test domain
server {
listen 80;
server_name localhost altinn3local.no;
return 307 $scheme://${TEST_DOMAIN}:${ALTINN3LOCAL_PORT}$request_uri;
}
upstream receiptcomp {
server ${INTERNAL_DOMAIN}:5060;
}
upstream pdfservice {
server ${INTERNAL_DOMAIN}:5300;
}
upstream accessmanagementbff {
server ${INTERNAL_DOMAIN}:5110;
}
server {
listen 80 default_server;
server_name ${TEST_DOMAIN};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
error_page 502 /502LocalTest.html;
location = / {
proxy_pass http://localtest/Home/;
sub_filter '<script src="/_framework/aspnetcore-browser-refresh.js"></script>' '<script src="/Home/_framework/aspnetcore-browser-refresh.js"></script>';
}
location / {
#Support using Local js, when a cookie value is set
subs_filter_types text/html;
subs_filter http.+\/(altinn-app-frontend\.(js|css)) $LOCAL_SUB_FILTER$1 gr;
subs_filter_bypass $SUB_FILTER_BYPASS;
proxy_pass http://app/;
error_page 502 /502App.html;
proxy_cookie_domain altinn3local.no local.altinn.cloud;
}
location /Home/_framework/ {
proxy_pass http://localtest/_framework/;
}
location /Home/ {
proxy_pass http://localtest/Home/;
sub_filter '<script src="/_framework/aspnetcore-browser-refresh.js"></script>' '<script src="/Home/_framework/aspnetcore-browser-refresh.js"></script>';
}
location /receipt/ {
proxy_pass http://receiptcomp/receipt/;
error_page 502 /502Receipt.html;
}
location /storage/ {
proxy_pass http://localtest/storage/;
}
location /pdfservice/ {
proxy_pass http://pdfservice/;
}
location /localtestresources/ {
proxy_pass http://localtest/localtestresources/;
}
location /LocalPlatformStorage/ {
proxy_pass http://localtest/LocalPlatformStorage/;
sub_filter '<script src="/_framework/aspnetcore-browser-refresh.js"></script>' '';
}
location /502LocalTest.html {
root /www;
}
location /502App.html {
root /www;
}
location /502Receipt.html {
root /www;
}
location /502Accessmanagement.html {
root /www;
}
}
server {
listen 80;
server_name ${AMUI_TEST_DOMAIN};
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
error_page 502 /502Accessmanagement.html;
location = / {
proxy_pass http://accessmanagementbff/accessmanagment/;
}
location / {
#Support using Local js, when a cookie value is set
sub_filter_once off;
sub_filter 'https://altinncdn.no/toolkits/altinn-app-frontend/3/' $LOCAL_SUB_FILTER;
proxy_pass http://accessmanagementbff/;
error_page 502 /502Accessmanagement.html;
proxy_cookie_domain altinn3local.no local.altinn.cloud;
}
location /502Accessmanagement.html {
root /www;
}
}
}