forked from erda-project/erda-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf.template
160 lines (137 loc) · 4.98 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
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html; # dice | gts
# 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":"diceUI","status":"ok"}';
}
location / {
index index.html;
try_files /static/shell/index.html /index.html =404;
}
location /market {
index /static/shell/market.html;
try_files /market.html =404;
}
location /apiManage {
index /static/shell/index.html;
try_files /index.html =404;
}
set $taEnabled ${TA_ENABLE};
set $taUrl //${COLLECTOR_PUBLIC_ADDR}/ta.js;
set $collectorUrl //${COLLECTOR_PUBLIC_ADDR}/collect;
set $terminusKey ${TERMINUS_KEY};
# set $openapiAddr ${OPENAPI_ADDR};
# set $gittarAddr ${GITTAR_ADDR};
location /ta {
default_type application/javascript;
return 200 'window._taConfig={enabled:$taEnabled,ak:"$terminusKey",url:"$taUrl",collectorUrl:"$collectorUrl"}';
}
location /erda-platform-home {
return 302 ${UI_PUBLIC_URL};
}
location /api {
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/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 ^~ /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;
}
location ^~ /api/repo {
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 {
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/apim-ws/api-docs/filetree {
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;
}
# 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;
}
set $url_backend $arg_url;
set $portal_host "";
set $portal_dest "";
location /api/terminal {
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/(command|proxy) {
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;
}
}