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;
25 location = /openoui/microservices {
26 rewrite /openoui/microservices /openoui/microservices/index.html redirect;
30 set $server "fallback";
35 rewrite_by_lua_file luaext/customrouter.lua;
37 proxy_pass http://$server;
39 location ~ ^/api/(.*) {
40 rewrite ^/api/(.*) /openoapi/$1 last;
42 location ~ ^/iui/(.*) {
43 rewrite ^/iui/(.*) /openoui/$1 last;
45 location ~ ^/openoapi/([^/]+)(/[Vv][^/]*)?(.*) {
48 set $apiserver "fallback";
52 rewrite_by_lua_file luaext/openoapirouter.lua;
54 proxy_pass http://$apiserver;
57 location ~ ^/openoui/([^/]+)(.*) {
58 location ~* ^/iui/([^/]+)(.*)\.(?:png|jpg|jpeg|js|css|html|gif|ico|bmp|woff)$ {
61 set $iuiserver "fallback";
65 rewrite_by_lua_file luaext/openouirouter.lua;
67 proxy_cache nginx_cache;
68 proxy_cache_key $host$uri$is_args$args;
69 proxy_cache_valid 200 304 12h ;
70 proxy_cache_valid 301 302 1m ;
71 proxy_cache_valid any 1m ;
74 proxy_pass http://$iuiserver;
78 set $iuiserver "fallback";
82 rewrite_by_lua_file luaext/openouirouter.lua;
84 proxy_pass http://$iuiserver;
87 location ~ ^/admin/([^/]+)(/[Vv][^/]*)?(.*) {
90 set $apiserver "fallback";
94 rewrite_by_lua_file luaext/openoadminrouter.lua;
96 proxy_pass http://$apiserver;
99 location ~ ^/apijson/([^/]+)(/[Vv][^/]*)?(.*) {
100 location ~* ^/apijson/([^/]+)(/[v][^/]*)?(.*)\.(?:png|jpg|jpeg|js|css|html|gif|ico|bmp|woff)$ {
103 set $apiserver "fallback";
107 rewrite_by_lua_file luaext/openoapijsonrouter.lua;
109 proxy_cache nginx_cache;
110 proxy_cache_key $host$uri$is_args$args;
111 proxy_cache_valid 200 304 12h ;
112 proxy_cache_valid 301 302 1m ;
113 proxy_cache_valid any 1m ;
116 proxy_pass http://$apiserver;
120 set $apiserver "fallback";
124 rewrite_by_lua_file luaext/openoapijsonrouter.lua;
126 proxy_pass http://$apiserver;
129 location ~* \.(?:png|jpg|jpeg|js|css|html|gif|ico|bmp|woff)$ {
130 set $server "fallback";
135 rewrite_by_lua_file luaext/customrouter.lua;
137 proxy_cache nginx_cache;
138 proxy_cache_key $host$uri$is_args$args;
139 proxy_cache_valid 200 304 12h ;
140 proxy_cache_valid 301 302 1m ;
141 proxy_cache_valid any 1m ;
144 proxy_pass http://$server;
147 location = /favicon.ico {