2 # Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 #the maximum allowed size of the client request body,current 10G
18 client_max_body_size 10240m;
19 client_body_buffer_size 128k;
21 #set conf for proxy pass
22 proxy_connect_timeout 10s;
23 proxy_read_timeout 120s;
24 proxy_send_timeout 120s;
25 proxy_set_header X-Real-IP $remote_addr;
26 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
27 proxy_set_header Host $host:$server_port;
30 #set the nginx_cache parameter
31 proxy_cache_path temp/proxy_cache levels=1:2 keys_zone=nginx_cache:100m inactive=1d max_size=1g;
32 proxy_cache_key $host$uri$is_args$args;
33 proxy_cache_revalidate on;
34 proxy_cache_min_uses 3;
35 proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
39 lua_package_path "$prefix/../lualib/?.lua;$prefix/luaext/?.lua;;";
40 lua_package_cpath "$prefix/../lualib/?.so;;";
41 lua_shared_dict rr_cache 1M;
42 lua_shared_dict rr_locks 100k;
44 lua_shared_dict svc_cache 5M;
45 lua_shared_dict locks 200k;
49 # Basic reverse proxy server processor
50 upstream defaultbackend {
52 balancer_by_lua_file luaext/loadbalance/balancer.lua;
58 default_type text/html;
60 # the flag identify whether to check doing internal redirect or not
61 set $websocket_internal_redirect "on";
64 #try_files $uri @defaulthomepage;
65 rewrite ^ /iui/microservices/default.html redirect;
68 location = /iui/microservices {
69 try_files $uri @addslash;
73 return 302 $scheme://$http_host$uri/;
76 location @defaulthomepage {
77 return 302 $scheme://$http_host/iui/microservices/default.html;
80 error_page 410 = @commonnotfound;
82 location @commonnotfound {
83 set $svc_type "custom";
86 set $backend "defaultbackend";
88 #rewrite by the lua file
89 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
91 log_by_lua_file luaext/log/logger.lua;
93 proxy_pass http://$backend;
94 proxy_redirect http://$host:$server_port$svc_url http://$host:$server_port$svc_name;
97 location @customwebsocket {
98 set $websocket_internal_redirect "off";
99 #set header for websocket
100 proxy_http_version 1.1;
101 proxy_set_header Upgrade $http_upgrade;
102 proxy_set_header Connection "Upgrade";
104 proxy_set_header X-Real-IP $remote_addr;
105 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
106 proxy_set_header Host $host:$server_port;
108 #rewrite by the lua file
109 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
111 log_by_lua_file luaext/log/logger.lua;
113 proxy_pass http://$backend;
116 location @commonwebsocket {
117 set $websocket_internal_redirect "off";
118 #set header for websocket
119 proxy_http_version 1.1;
120 proxy_set_header Upgrade $http_upgrade;
121 proxy_set_header Connection "Upgrade";
123 proxy_set_header X-Real-IP $remote_addr;
124 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
125 proxy_set_header Host $host:$server_port;
127 #rewrite by the lua file
128 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
130 log_by_lua_file luaext/log/logger.lua;
132 proxy_pass http://$backend;
136 set $svc_type "custom";
139 set $backend "defaultbackend";
141 #rewrite by the lua file
142 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
144 log_by_lua_file luaext/log/logger.lua;
146 proxy_pass http://$backend;
147 proxy_redirect http://$host:$server_port$svc_url http://$host:$server_port$svc_name;
150 location ~ ^/(api|admin|apijson)(/[Vv]\d+(?:\.\d+)*)?/([^/]+)(/[Vv]\d+(?:\.\d+)*)?(.*) {
153 set $svc_version1 $2;
154 set $svc_version2 $4;
156 set $backend "defaultbackend";
158 #rewrite by the lua file
159 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
161 log_by_lua_file luaext/log/logger.lua;
163 proxy_pass http://$backend;
166 location ~* ^/iui/([^/]+)(.*)\.(png|jpg|jpeg|gif|ico|bmp|woff)$ {
170 set $backend "defaultbackend";
172 #rewrite by the lua file
173 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
175 log_by_lua_file luaext/log/logger.lua;
177 proxy_cache nginx_cache;
178 add_header X-Cache-Status $upstream_cache_status;
179 proxy_pass http://$backend;
182 location ~ ^/iui/([^/]+)(.*) {
186 set $backend "defaultbackend";
188 #rewrite by the lua file
189 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
191 log_by_lua_file luaext/log/logger.lua;
193 proxy_pass http://$backend;
196 location ~* \.(?:png|jpg|jpeg|gif|ico|bmp|woff)$ {
197 set $svc_type "custom";
200 set $backend "defaultbackend";
202 #rewrite by the lua file
203 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
205 log_by_lua_file luaext/log/logger.lua;
207 proxy_cache nginx_cache;
208 add_header X-Cache-Status $upstream_cache_status;
209 proxy_pass http://$backend;
210 proxy_redirect http://$host:$server_port$svc_url http://$host:$server_port$svc_name;
213 location = /favicon.ico {
216 include ../msb-enabled/location-ext/*.conf;
217 include ../msb-enabled/location-ext-mount/*.conf;