feature: add apisix-version info to headers in APISIX core (#1961)

related #1877
This commit is contained in:
Swayam Raina 2020-08-15 04:54:33 +05:30 committed by GitHub
parent 240942e941
commit 6e0da454d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 1 deletions

View File

@ -23,7 +23,7 @@ local service_fetch = require("apisix.http.service").get
local admin_init = require("apisix.admin.init")
local get_var = require("resty.ngxvar").fetch
local router = require("apisix.router")
local set_upstream = require("apisix.upstream").set_by_route
local set_upstream = require("apisix.upstream").set_by_route
local ipmatcher = require("resty.ipmatcher")
local ngx = ngx
local get_method = ngx.req.get_method
@ -40,6 +40,7 @@ local load_balancer
local local_conf
local dns_resolver
local lru_resolved_domain
local ver_header = "APISIX/" .. core.version.VERSION
local function parse_args(args)
@ -301,6 +302,8 @@ function _M.http_access_phase()
core.ctx.set_vars_meta(api_ctx)
core.response.set_header("Server", ver_header)
-- load and run global rule
if router.global_rules and router.global_rules.values
and #router.global_rules.values > 0 then

View File

@ -114,6 +114,7 @@ request sent: 59
received: HTTP/1.1 200 OK
received: Content-Type: text/plain
received: Connection: close
received: Server: APISIX/\d\.\d+(\.\d+)?
received: Server: \w+
received:
received: hello world

View File

@ -669,6 +669,7 @@ sent http request: 58 bytes.
received: HTTP/1.1 200 OK
received: Content-Type: text/plain
received: Connection: close
received: Server: APISIX/\d\.\d+(\.\d+)?
received: Server: \w+
received: \nreceived: hello world
close: 1 nil}

View File

@ -160,6 +160,7 @@ sent http request: 62 bytes.
received: HTTP/1.1 200 OK
received: Content-Type: text/plain
received: Connection: close
received: Server: APISIX/\d\.\d+(\.\d+)?
received: Server: \w+
received: \nreceived: hello world
close: 1 nil}

View File

@ -160,6 +160,7 @@ sent http request: 62 bytes.
received: HTTP/1.1 200 OK
received: Content-Type: text/plain
received: Connection: close
received: Server: APISIX/\d\.\d+(\.\d+)?
received: Server: \w+
received: \nreceived: hello world
close: 1 nil}
@ -313,6 +314,7 @@ sent http request: 62 bytes.
received: HTTP/1.1 200 OK
received: Content-Type: text/plain
received: Connection: close
received: Server: APISIX/\d\.\d+(\.\d+)?
received: Server: \w+
received: \nreceived: hello world
close: 1 nil}
@ -426,6 +428,7 @@ sent http request: 58 bytes.
received: HTTP/1.1 200 OK
received: Content-Type: text/plain
received: Connection: close
received: Server: APISIX/\d\.\d+(\.\d+)?
received: Server: \w+
received: \nreceived: hello world
close: 1 nil}