Custom Response Headers are not set when using file provider

Hey @ldez

I'm trying to set custom response headers using the file provider, but the headers are not being applied to the responses.

Dynamic file configuration

  rule = "Host(``) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
  service = "api@internal"
  middlewares = ["auth"]

  users = [

  address = ""
  authResponseHeaders = ["x-user-data", "authorization"]

  accessControlAllowMethods = ["OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE"]
  accessControlAllowHeaders = ["Authorization", "Content-Type", "X-Vault-Password", "User-Uid", "User-Email", "User-Organization", "User-Labels", "User-Role", "User-Internal", "User-Is_Owner", "User-Is_Manager", "Range", "Content-Range"]
  accessControlExposeHeaders = ["X-Total-Count", "X-Result-Count", "X-Page-Count"]
  accessControlAllowOriginList = ["*"]
  addVaryHeader = true

        X-Custom = "some-value"

Also, in the dashboard, I see the middleware as below.

Please help!


you have to set the middlewares on your routers:

  rule = "Host(``) && (PathPrefix(`/api`) || PathPrefix(`/dashboard`))"
  service = "api@internal"
  middlewares = ["auth", "headers", "testHeader"]
1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.