Contact Free trial Login

Header Injection and Removal

Policy Name

Header injection/Header removal


Adds/removes headers to a request or a response


Since Mule Version


Returned Status Codes

The Header Injection policy adds headers to the request/response of the message. The Header Removal policy removes all listed headers.

header inject remove diagram

Applying Header Injection Policy

To apply this policy to an API, specify an inbound/outbound map of the headers that you want to add in the message processing in the form of a key-value pair.

inbound header map
outbound header map

If the injected header already exists in the message attributes, the policy creates a new header, without overriding the value of the existing one. This action creates two headers with the same name.

Note: Comma separated values are not considered multiple values by the Mule HTTP Connector.

You can use DataWeave expressions to set a value. For example:


To overwrite the value of a header, remove it before injecting the header.

Applying Header Removal Policy

To apply this policy to an API, specify the header names as regular expressions, separated by commas.

For example:

remove inbound header
remove outbound header

The content-type and content-length headers of a request can be filtered by this policy, as shown in this example, as well as the host header.

In the response, only the content-type header is removed.

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub