unit
unit copied to clipboard
Support for modifying request headers
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