unit icon indicating copy to clipboard operation
unit copied to clipboard

Support for modifying request headers

Open txigreman opened this issue 11 months ago • 3 comments

Description

In the routes configuration section we have the possibility to add/set/remove response headers. I think we need a similar feature to handle request headers.

Use cases

Pass $request_id to the application so it can be attached to the logs to improve traceability:

{
  "match": {
    "uri": "/admin/*"
  },
  "action": {
    "pass": "applications/my_application/backoffice",
    "request_headers": {
      "Request-ID": "$request_id"
    }
  }
}

Handle X-Forwarded-Prefix:

{
  "match": {
    "uri": "/api/*"
  },
  "action": {
    "rewrite": `${uri.substr('/api'.length)}`,
    "request_headers": {
      "X-Forwarded-Prefix": "/api"
    },
    "pass": "applications/my_application/api"
  }
}

Related issues and discussions

This topic was discussed in #1183 There is a similar request in #1021

txigreman avatar Mar 13 '24 12:03 txigreman