Kong: Ability to customize `Via` and `X-Kong*` headers

Created on 14 Jun 2016  路  2Comments  路  Source: Kong/kong

I need to remove Via and X-Kong* headers (maybe adding them to a log field to keep debugging information somewhere.

HTTP/1.1 200 OK
Date: Tue, 14 Jun 2016 09:57:11 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 859
Connection: keep-alive
Server: nginx
Last-Modified: Fri, 10 Jun 2016 11:57:58 GMT
Vary: Accept-Encoding
ETag: "575aab46-35b"
Strict-Transport-Security: max-age=31536000; includeSubdomains;
Accept-Ranges: bytes
X-Kong-Upstream-Latency: 3
X-Kong-Proxy-Latency: 0
Via: kong/0.8.0

Is there a way to customize kong's response headers so that I can have better control over them?

Most helpful comment

Seems to be duplicate of #1009 - I am currently working around it by adding the following statements to the /etc/kong/kong.yml file to modify the nginx configuration.

        # Add additional response headers
        header_filter_by_lua_block {
           kong.header_filter()
           ngx.header["Server"] = nil
           ngx.header["Via"] = nil
           ngx.header["X-Kong-Proxy-Latency"] = nil
           ngx.header["X-Kong-Upstream-Latency"] = nil
        }

All 2 comments

Seems to be duplicate of #1009 - I am currently working around it by adding the following statements to the /etc/kong/kong.yml file to modify the nginx configuration.

        # Add additional response headers
        header_filter_by_lua_block {
           kong.header_filter()
           ngx.header["Server"] = nil
           ngx.header["Via"] = nil
           ngx.header["X-Kong-Proxy-Latency"] = nil
           ngx.header["X-Kong-Upstream-Latency"] = nil
        }

That solves my problem, thanks!

Was this page helpful?
0 / 5 - 0 ratings