apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: When accessing APISIX route, there are two servers in the response header.

Open idbeta opened this issue 6 years ago • 3 comments

Issue description

When accessing APISIX route, there are two Server in the response header, one of which is upstream, can they used different key names?

$ curl  http://127.0.0.1:9080/test_core -i
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX/2.0
Server: BaseHTTP/0.3 Python/2.7.13
Date: Thu, 12 Nov 2020 04:31:03 GMT

tested by python

Environment

  • apisix version (cmd: apisix version): master
  • OS:

idbeta avatar Nov 12 '20 04:11 idbeta

We can remove the upstream one.

spacewander avatar Nov 12 '20 05:11 spacewander

I think it's better to just leave Server: APISIX/2.0 and override the other server header field!

demo:


$ curl  http://127.0.0.1:9080/test_core -i
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX/2.0
Date: Thu, 12 Nov 2020 04:31:03 GMT

tested by python

Miss-you avatar Nov 12 '20 08:11 Miss-you

here is the bug.

image

ref: https://github.com/apache/apisix/blob/master/apisix/init.lua#L341

Miss-you avatar Nov 12 '20 11:11 Miss-you