Skip to main content

HTTP Header Rewriting

The HTTP header rewriting feature allows users to add, replace, or remove headers in HTTP requests or responses that match specific URLs. Below are detailed explanations of each operation and their corresponding fields:

Adding Header Information

Field NameTypeRequiredDescription
matchstringYesUsed to match the URL
namestringYesThe name of the header to add
valuestringYesThe value of the header to add
typestringYesDefines the type of message to modify (can be request or response)
header_rewrites:
- add:
match: "http://www\\.egernapp\\.com/egern.html"
name: Hello
value: World
type: request

In this example, the system will add a header named "Hello" with a value of "World" to all request messages where the URL matches "http://www.egernapp\\.com/egern.html".

Replacing Header Information

Field NameTypeRequiredDescription
matchstringYesUsed to match the URL
namestringYesThe name of the header to replace
valuestringYesThe new value of the header
typestringYesDefines the type of message to modify (can be request or response)
header_rewrites:
- replace:
match: "http://www\\.egernapp\\.com/egern.html"
name: Hello
value: World
type: request

In this example, the system will look for a header named "Hello" in all request messages where the URL matches "http://www.egernapp\\.com/egern.html" and replace its value with "World".

Deleting Header Information

Field NameTypeRequiredDescription
matchstringYesUsed to match the URL
namestringYesThe name of the header to delete
typestringYesDefines the type of message to modify (can be request or response)
header_rewrites:
- delete:
match: "http://www\\.egernapp\\.com/egern.html"
name: Hello
type: request

In this example, the system will delete a header named "Hello" from all request messages where the URL matches "http://www.egernapp\\.com/egern.html".