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 default_type text/html;
19 # the flag identify whether to check doing internal redirect or not
20 set $websocket_internal_redirect "on";
21 set $http_protocol "http";
24 location = /iui/microservices {
25 try_files $uri @addslash;
29 return 302 $scheme://$http_host$uri/;
32 #error_page 410 = @commonnotfound;
34 location @commonnotfound {
35 set $svc_type "custom";
38 set $backend "defaultbackend";
40 #rewrite by the lua file
41 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
45 header_filter_by_lua_block {
49 log_by_lua_file luaext/log/logger.lua;
51 proxy_pass $http_protocol://$backend;
52 proxy_redirect $http_protocol://$host:$server_port$svc_url $http_protocol://$host:$server_port$svc_name;
55 location @customwebsocket {
56 set $websocket_internal_redirect "off";
57 #set header for websocket
58 proxy_http_version 1.1;
59 proxy_set_header Upgrade $http_upgrade;
60 proxy_set_header Connection "Upgrade";
62 proxy_set_header X-Real-IP $remote_addr;
63 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
64 proxy_set_header Host $host:$server_port;
66 #rewrite by the lua file
67 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
71 header_filter_by_lua_block {
75 log_by_lua_file luaext/log/logger.lua;
77 proxy_pass $http_protocol://$backend;
80 location @commonwebsocket {
81 set $websocket_internal_redirect "off";
82 #set header for websocket
83 proxy_http_version 1.1;
84 proxy_set_header Upgrade $http_upgrade;
85 proxy_set_header Connection "Upgrade";
87 proxy_set_header X-Real-IP $remote_addr;
88 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
89 proxy_set_header Host $host:$server_port;
91 #rewrite by the lua file
92 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
96 header_filter_by_lua_block {
100 log_by_lua_file luaext/log/logger.lua;
102 proxy_pass $http_protocol://$backend;
106 set $svc_type "custom";
109 set $backend "defaultbackend";
111 #rewrite by the lua file
112 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
113 access_by_lua_block {
116 header_filter_by_lua_block {
120 log_by_lua_file luaext/log/logger.lua;
122 proxy_pass $http_protocol://$backend;
123 proxy_redirect $http_protocol://$host:$server_port$svc_url $http_protocol://$host:$server_port$svc_name;
126 location ~ ^/(api|admin|apijson)(/[Vv]\d+(?:\.\d+)*)?/([^/]+)(/[Vv]\d+(?:\.\d+)*)?(.*) {
129 set $svc_version1 $2;
130 set $svc_version2 $4;
132 set $backend "defaultbackend";
134 #rewrite by the lua file
135 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
136 access_by_lua_block {
139 header_filter_by_lua_block {
143 log_by_lua_file luaext/log/logger.lua;
145 proxy_pass $http_protocol://$backend;
148 location ~* ^/iui/([^/]+)(.*)\.(png|jpg|jpeg|gif|ico|bmp|woff)$ {
152 set $backend "defaultbackend";
154 #rewrite by the lua file
155 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
156 access_by_lua_block {
159 header_filter_by_lua_block {
163 log_by_lua_file luaext/log/logger.lua;
165 proxy_cache nginx_cache;
166 add_header X-Cache-Status $upstream_cache_status;
167 proxy_pass $http_protocol://$backend;
170 location ~ ^/iui/([^/]+)(.*) {
174 set $backend "defaultbackend";
176 #rewrite by the lua file
177 rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
178 access_by_lua_block {
181 header_filter_by_lua_block {
185 log_by_lua_file luaext/log/logger.lua;
187 proxy_pass $http_protocol://$backend;
190 include ../msb-enabled/location-ext/*.conf;
191 include ../msb-enabled/location-ext-mount/*.conf;
193 location ~* \.(?:png|jpg|jpeg|gif|ico|bmp|woff)$ {
194 set $svc_type "custom";
197 set $backend "defaultbackend";
199 #rewrite by the lua file
200 rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
201 access_by_lua_block {
204 header_filter_by_lua_block {
208 log_by_lua_file luaext/log/logger.lua;
210 proxy_cache nginx_cache;
211 add_header X-Cache-Status $upstream_cache_status;
212 proxy_pass $http_protocol://$backend;
213 proxy_redirect http://$host:$server_port$svc_url http://$host:$server_port$svc_name;
216 location = /favicon.ico {