2

I'm trying to remove the Server header by using the following declarative map in a serverless approach:

plugins:
  - name: response-transformer
    service: my-service
    config:
      remove.headers: Server

but I get:

in 'plugins':
 - in entry 1 of 'plugins':
in 'config':
  in 'remove.headers': unknown field

I also tried to override the value but it just seems that the above configuration has something missing...what am I doing wrong?

Phate
  • 6,066
  • 15
  • 73
  • 138

3 Answers3

3

The format is like this

- name: response-transformer
    service: my-service
    config:
      remove:
        headers: ["Server","Via"]
keikai
  • 14,085
  • 9
  • 49
  • 68
  • 2
    This does not remove the "Via" header. – Marco May 08 '20 at 09:07
  • 1
    These headers are injected by Kong post the execution of this plugin, so it won't remove those headers – deadzg_devil Jun 16 '21 at 14:47
  • 1
    @deadzg_devil thank you for this. I've been spinning in circles wondering why the plugin wasn't working. But it was working the entire time it seems – MichaelM Jan 25 '22 at 17:15
  • can you pls tell me which file should be edited with this ? I'm also facing the same issue – Cjo May 15 '23 at 11:37
3

The following kong configuration can be used to get rid of the "Via" header:

- name: KONG_HEADERS
  value: "off"

This removes the kong related headers. However, this doesn't seem to remove the "Server" header.

d.sndrs
  • 61
  • 5
0

Based on the type of deployment turn the headers off using KONG_HEADERS: off

You can also selectively remove the headers.

List of all the Kong headers injected: https://docs.konghq.com/gateway-oss/2.3.x/configuration/#headers

deadzg_devil
  • 376
  • 2
  • 10