summaryrefslogtreecommitdiffstats
path: root/openresty-ext/src/assembly/resources/openresty/nginx/msb-enabled/location-default/msblocations.conf
diff options
context:
space:
mode:
Diffstat (limited to 'openresty-ext/src/assembly/resources/openresty/nginx/msb-enabled/location-default/msblocations.conf')
-rw-r--r--openresty-ext/src/assembly/resources/openresty/nginx/msb-enabled/location-default/msblocations.conf116
1 files changed, 67 insertions, 49 deletions
diff --git a/openresty-ext/src/assembly/resources/openresty/nginx/msb-enabled/location-default/msblocations.conf b/openresty-ext/src/assembly/resources/openresty/nginx/msb-enabled/location-default/msblocations.conf
index 745c290..2150e70 100644
--- a/openresty-ext/src/assembly/resources/openresty/nginx/msb-enabled/location-default/msblocations.conf
+++ b/openresty-ext/src/assembly/resources/openresty/nginx/msb-enabled/location-default/msblocations.conf
@@ -1,5 +1,5 @@
#
-# Copyright (C) 2016 ZTE, Inc. and others. All rights reserved. (ZTE)
+# Copyright (C) 2017-2018 ZTE, Inc. and others. All rights reserved. (ZTE)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,10 +16,7 @@
default_type text/html;
- # the flag identify whether to check doing internal redirect or not
- set $websocket_internal_redirect "on";
set $http_protocol "http";
-
location = /iui/microservices {
try_files $uri @addslash;
@@ -37,23 +34,29 @@
set $svc_url "";
set $backend "defaultbackend";
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
access_by_lua_block {
+ ngx.log(ngx.INFO, ngx.var.request_id..":receive the request")
+ msb.filter_websocket_req()
+ msb.route()
msb.access()
+ if ngx.ctx.use_ownupstream then
+ stats.forward_backend()
+ end
}
header_filter_by_lua_block {
+ stats.receive_response()
msb.header_filter()
+ stats.return_response()
}
#log by the lua file
log_by_lua_file luaext/log/logger.lua;
proxy_pass $http_protocol://$backend;
- proxy_redirect $http_protocol://$host:$server_port$svc_url $http_protocol://$host:$server_port$svc_name;
+ #proxy_redirect $http_protocol://$host:$server_port$svc_url $http_protocol://$host:$server_port$svc_name;
}
- location @customwebsocket {
- set $websocket_internal_redirect "off";
+ location @websocket {
+ set $stats_new_req "false";
#set header for websocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
@@ -63,38 +66,18 @@
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
- access_by_lua_block {
- msb.access()
- }
- header_filter_by_lua_block {
- msb.header_filter()
- }
- #log by the lua file
- log_by_lua_file luaext/log/logger.lua;
-
- proxy_pass $http_protocol://$backend;
- }
-
- location @commonwebsocket {
- set $websocket_internal_redirect "off";
- #set header for websocket
- 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;
- proxy_set_header Host $host:$server_port;
-
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
access_by_lua_block {
+ ngx.log(ngx.INFO, ngx.var.request_id..":receive the request")
+ msb.route()
msb.access()
+ if ngx.ctx.use_ownupstream then
+ stats.forward_backend()
+ end
}
header_filter_by_lua_block {
+ stats.receive_response()
msb.header_filter()
+ stats.return_response()
}
#log by the lua file
log_by_lua_file luaext/log/logger.lua;
@@ -108,19 +91,26 @@
set $svc_url "";
set $backend "defaultbackend";
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
access_by_lua_block {
+ ngx.log(ngx.INFO, ngx.var.request_id..":receive the request")
+ stats.accept_new_request()
+ msb.filter_websocket_req()
+ msb.route()
msb.access()
+ if ngx.ctx.use_ownupstream then
+ stats.forward_backend()
+ end
}
header_filter_by_lua_block {
+ stats.receive_response()
msb.header_filter()
+ stats.return_response()
}
#log by the lua file
log_by_lua_file luaext/log/logger.lua;
proxy_pass $http_protocol://$backend;
- proxy_redirect $http_protocol://$host:$server_port$svc_url $http_protocol://$host:$server_port$svc_name;
+ #proxy_redirect $http_protocol://$host:$server_port$svc_url $http_protocol://$host:$server_port$svc_name;
}
location ~ ^/(api|admin|apijson)(/[Vv]\d+(?:\.\d+)*)?/([^/]+)(/[Vv]\d+(?:\.\d+)*)?(.*) {
@@ -131,13 +121,20 @@
set $req_res $5;
set $backend "defaultbackend";
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
access_by_lua_block {
+ ngx.log(ngx.INFO, ngx.var.request_id..":receive the request")
+ stats.accept_new_request()
+ msb.filter_websocket_req()
+ msb.route()
msb.access()
+ if ngx.ctx.use_ownupstream then
+ stats.forward_backend()
+ end
}
header_filter_by_lua_block {
+ stats.receive_response()
msb.header_filter()
+ stats.return_response()
}
#log by the lua file
log_by_lua_file luaext/log/logger.lua;
@@ -151,13 +148,20 @@
set $req_res $2.$3;
set $backend "defaultbackend";
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
access_by_lua_block {
+ ngx.log(ngx.INFO, ngx.var.request_id..":receive the request")
+ stats.accept_new_request()
+ msb.filter_websocket_req()
+ msb.route()
msb.access()
+ if ngx.ctx.use_ownupstream then
+ stats.forward_backend()
+ end
}
header_filter_by_lua_block {
+ stats.receive_response()
msb.header_filter()
+ stats.return_response()
}
#log by the lua file
log_by_lua_file luaext/log/logger.lua;
@@ -173,13 +177,20 @@
set $req_res $2;
set $backend "defaultbackend";
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/commonrewrite.lua;
access_by_lua_block {
+ ngx.log(ngx.INFO, ngx.var.request_id..":receive the request")
+ stats.accept_new_request()
+ msb.filter_websocket_req()
+ msb.route()
msb.access()
+ if ngx.ctx.use_ownupstream then
+ stats.forward_backend()
+ end
}
header_filter_by_lua_block {
+ stats.receive_response()
msb.header_filter()
+ stats.return_response()
}
#log by the lua file
log_by_lua_file luaext/log/logger.lua;
@@ -196,13 +207,20 @@
set $svc_url "";
set $backend "defaultbackend";
- #rewrite by the lua file
- rewrite_by_lua_file luaext/rewrite/customrewrite.lua;
access_by_lua_block {
+ ngx.log(ngx.INFO, ngx.var.request_id..":receive the request")
+ stats.accept_new_request()
+ msb.filter_websocket_req()
+ msb.route()
msb.access()
+ if ngx.ctx.use_ownupstream then
+ stats.forward_backend()
+ end
}
header_filter_by_lua_block {
+ stats.receive_response()
msb.header_filter()
+ stats.return_response()
}
#log by the lua file
log_by_lua_file luaext/log/logger.lua;
@@ -210,9 +228,9 @@
proxy_cache nginx_cache;
add_header X-Cache-Status $upstream_cache_status;
proxy_pass $http_protocol://$backend;
- proxy_redirect http://$host:$server_port$svc_url http://$host:$server_port$svc_name;
+ #proxy_redirect http://$host:$server_port$svc_url http://$host:$server_port$svc_name;
}
location = /favicon.ico {
log_not_found off;
- } \ No newline at end of file
+ }