forked from erda-project/erda-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf.template
187 lines (162 loc) · 6.14 KB
/
nginx.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
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
181
182
183
184
185
186
187
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
# compression
gzip on;
gzip_min_length 2k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 3;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
client_max_body_size 0;
set $my_scheme "http";
if ($http_x_forwarded_proto = "https") {
set $my_scheme "https";
}
if ($request_method !~ ^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)$ ) {
return 403;
}
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Cache-Control no-cache;
#static files
location ~* ^/static/ {
expires 30d;
}
location /version\.(json)$ {
expires -1;
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
}
location /_api/health {
default_type application/json;
return 200 '{"name":"erdaUI","status":"ok"}';
}
location / {
index index.html;
try_files /static/shell/index.html /index.html =404;
}
set $taEnabled ${TA_ENABLE};
set $taUrl //${COLLECTOR_PUBLIC_ADDR}/ta.js;
set $collectorUrl //${COLLECTOR_PUBLIC_ADDR}/collect;
set $terminusKey ${TERMINUS_KEY};
location /ta {
default_type application/javascript;
return 200 'window._taConfig={enabled:$taEnabled,ak:"$terminusKey",url:"$taUrl",collectorUrl:"$collectorUrl"}';
}
location ~ ^/(workBench|microService|dataCenter|orgCenter|edge|sysAdmin|org-list|noAuth|freshMan|inviteToOrg|perm) {
return 302 /-$request_uri;
}
location /api/dice-env {
default_type application/javascript;
return 200 'window.diceEnv={
"ENABLE_MPAAS":${ENABLE_MPAAS},
"ENABLE_BIGDATA":${ENABLE_BIGDATA},
"ONLY_FDP":${ONLY_FDP},
"UC_PUBLIC_URL":"${UC_PUBLIC_URL}"
}';
}
location ^~ /api/files {
proxy_pass http://${OPENAPI_ADDR};
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 $my_scheme;
proxy_set_header Host $http_host;
}
location ~* ^/api/[^/]*/repo {
rewrite /api/([^/]*)/(.*) /api/$2 break;
proxy_set_header org $1;
proxy_pass http://${OPENAPI_ADDR};
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 $my_scheme;
proxy_set_header Host $http_host;
keepalive_timeout 500;
proxy_read_timeout 500;
}
location ~* ^/api/[^/]*/websocket {
rewrite /api/([^/]*)/(.*) /api/$2 break;
proxy_set_header org $1;
proxy_pass http://${OPENAPI_ADDR};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location ~* ^/api/[^/]*/terminal {
rewrite /api/([^/]*)/(.*) /api/$2 break;
proxy_set_header org $1;
proxy_pass http://${OPENAPI_ADDR};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^/api/[^/]*/apim-ws/api-docs/filetree {
rewrite /api/([^/]*)/(.*) /api/$2 break;
proxy_set_header org $1;
proxy_pass http://${OPENAPI_ADDR};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
set $url_backend $arg_url;
set $portal_host "";
set $portal_dest "";
location ~* ^/api/[^/]*/(command|proxy) {
rewrite /api/([^/]*)/(.*) /api/$2 break;
proxy_set_header org $1;
proxy_pass $url_backend;
proxy_set_header "portal-host" $portal_host;
proxy_set_header "portal-dest" $portal_dest;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ~* ^/api/[^/]*/ {
rewrite /api/([^/]*)/(.*) /api/$2 break;
proxy_set_header org $1;
proxy_pass http://${OPENAPI_ADDR};
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 $my_scheme;
proxy_set_header Host $http_host;
}
location ~* ^/[^/]*/market {
index market.html;
try_files /static/market/index.html =404;
}
location ^~ /fdp-app/ {
proxy_pass http://${FDP_UI_ADDR}/;
}
location ~* ^/api/[^/]*/fdp-websocket {
rewrite /api/([^/]*)/(.*) /api/$2 break;
proxy_set_header org $1;
proxy_pass http://${OPENAPI_ADDR};
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
location ^~ /wb {
proxy_pass http://${GITTAR_ADDR};
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 $my_scheme;
proxy_set_header Host $http_host;
keepalive_timeout 500;
proxy_read_timeout 500;
}
# dice 平台对外的元信息
location /metadata.json {
proxy_pass http://${OPENAPI_ADDR};
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 $my_scheme;
proxy_set_header Host $http_host;
}
}