Is it possible to configure headers middleware not to overwrite but to add

Could anybody help with the following configuration:

  • my service response header contains some content-security-policy header field
  • with traefik headers middleware I want to add the additional content-security-policy header field

So in a result client must receive a response with a header with two different content-security-policy header fields

Unfortunately, traefik headers middleware rewrite the service response header field, and I can't find a way to change this behavior.

Just dig into source code of headers middleware and unfortunately can't find any actual merge functionality - only delete (req.Header.Del) and overwrite (req.Header.Set) :frowning:.
Though that there is next comment in source code:

// PostRequestModifyResponseHeaders set or delete response headers.
// This method is called AFTER the response is generated from the backend
// and can merge/override headers from the backend response.

I would be very grateful if someone could tell me any possible workaround to merge headers fields from actual response and traefik middleware.