2 # Copyright 2016 2015-2016 ZTE, Inc. and others. All rights reserved.
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.
16 # Author: Zhaoxing Meng
17 # email: meng.zhaoxing1@zte.com.cn
22 default_type text/html;
23 add_header X-Cache-Status $upstream_cache_status;
26 rewrite ^ /openoui/common/login.html redirect;
29 location = /openoui/microservices {
30 rewrite /openoui/microservices /openoui/microservices/index.html redirect;
34 set $server "fallback";
39 rewrite_by_lua_file luaext/customrouter.lua;
40 access_by_lua_file luaext/execute_auth.lua;
42 proxy_pass http://$server;
44 location ~ ^/api/(.*) {
45 rewrite ^/api/(.*) /openoapi/$1 last;
47 location ~ ^/iui/(.*) {
48 rewrite ^/iui/(.*) /openoui/$1 last;
51 location ^~ /openoapi/driver_ {
55 local driver_manager = require('plugins.driver_manager')
56 driver_manager.access()
58 proxy_pass http://$backend;
60 location ~ ^/openoapi/([^/]+)(/[Vv][^/]*)?(.*) {
62 #Send requests to Driver Mgr. if 'X_Driver_Parameter' header found in the request
63 if ($http_X_Driver_Parameter) {
65 local driver_manager = require('plugins.driver_manager')
66 driver_manager.access()
72 set $apiserver "fallback";
76 rewrite_by_lua_file luaext/openoapirouter.lua;
77 access_by_lua_file luaext/execute_auth.lua;
79 proxy_pass http://$apiserver;
82 location ~ ^/openoui/([^/]+)(.*) {
83 location ~* ^/iui/([^/]+)(.*)\.(?:png|jpg|jpeg|js|css|html|gif|ico|bmp|woff)$ {
86 set $iuiserver "fallback";
90 rewrite_by_lua_file luaext/openouirouter.lua;
91 access_by_lua_file luaext/execute_auth.lua;
93 proxy_cache nginx_cache;
94 proxy_cache_key $host$uri$is_args$args;
95 proxy_cache_valid 200 304 12h ;
96 proxy_cache_valid 301 302 1m ;
97 proxy_cache_valid any 1m ;
100 proxy_pass http://$iuiserver;
104 set $iuiserver "fallback";
108 rewrite_by_lua_file luaext/openouirouter.lua;
109 access_by_lua_file luaext/execute_auth.lua;
111 proxy_pass http://$iuiserver;
114 location ~ ^/admin/([^/]+)(/[Vv][^/]*)?(.*) {
117 set $apiserver "fallback";
121 rewrite_by_lua_file luaext/openoadminrouter.lua;
122 access_by_lua_file luaext/execute_auth.lua;
124 proxy_pass http://$apiserver;
127 location ~ ^/apijson/([^/]+)(/[Vv][^/]*)?(.*) {
128 location ~* ^/apijson/([^/]+)(/[v][^/]*)?(.*)\.(?:png|jpg|jpeg|js|css|html|gif|ico|bmp|woff)$ {
131 set $apiserver "fallback";
135 rewrite_by_lua_file luaext/openoapijsonrouter.lua;
136 access_by_lua_file luaext/execute_auth.lua;
138 proxy_cache nginx_cache;
139 proxy_cache_key $host$uri$is_args$args;
140 proxy_cache_valid 200 304 12h ;
141 proxy_cache_valid 301 302 1m ;
142 proxy_cache_valid any 1m ;
145 proxy_pass http://$apiserver;
149 set $apiserver "fallback";
153 rewrite_by_lua_file luaext/openoapijsonrouter.lua;
154 access_by_lua_file luaext/execute_auth.lua;
156 proxy_pass http://$apiserver;
159 location ~* \.(?:png|jpg|jpeg|js|css|html|gif|ico|bmp|woff)$ {
160 set $server "fallback";
165 rewrite_by_lua_file luaext/customrouter.lua;
166 access_by_lua_file luaext/execute_auth.lua;
168 proxy_cache nginx_cache;
169 proxy_cache_key $host$uri$is_args$args;
170 proxy_cache_valid 200 304 12h ;
171 proxy_cache_valid 301 302 1m ;
172 proxy_cache_valid any 1m ;
175 proxy_pass http://$server;
178 location = /favicon.ico {