---
schema_version: "1"
id: 0a6a43b0f968fdf6b235785bd9f961e3314a84a9e69fb6d9c259c290882689fa
title: Header Removal Policy
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-gateway/policies-included-header-removal.md
canonical_url: https://docs.mulesoft.com/mule-gateway/policies-included-header-removal
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 16d891ca8daab19bbc2b950fa7fc1b1110cd7b186aa5a29ff949a8451b08f7e3
description: MuleSoft Documentation Site
latest: true
---
---
product: Mule Gateway
keywords: header removal, api gateway, mule gateway, gateway, policy
---

# Header Removal Policy

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

<table><colgroup><col> <col></colgroup><tbody><tr><td><p><strong>Policy name</strong></p></td><td><p>Header Removal</p></td></tr><tr><td><p><strong>Summary</strong></p></td><td><p>Removes headers from a request or a response</p></td></tr><tr><td><p><strong>Category</strong></p></td><td><p>Transformation</p></td></tr><tr><td><p><strong>Returned Status Codes</strong></p></td><td><p>500 - The configuration includes an expression that was not evaluated.</p></td></tr></tbody></table>

## Summary

The Header Removal policy removes all listed headers from a request or a response of a message when
you specify an inbound and outbound map of the headers that you want to remove with a key-value
pair.

![A flow chart illustrating the process of setting header injection and removal policies for clients accessing an API through a proxy](/mulesoft/current/en-us/mule-gateway/_images/header-inject-remove-diagram.png)

You can optionally include DataWeave expressions in the value of the header. For example, all
headers matching the following configured expression are injected to the message:

`“#[attributes.requestPath]”`

> [!NOTE] The following headers may not be removed: user-agent, accept, host, content-type,
> content-length, date, transfer-encoding, connection,

## Configuring Policy Parameters

### Mule Gateway

When you apply the Header Removal policy to your API from the UI, you can configure the following
parameters:

<table><colgroup><col> <col></colgroup><thead><tr><th><strong>Parameter</strong></th><th><strong>Description</strong></th></tr></thead><tbody><tr><td><div><div><p>Inbound Header Map</p></div></div></td><td><div><div><p>List of header names or regular expressions (comma separated) to be removed at the beginning of the message processing, for example, <code>Cache-Control, Access-Control.*</code></p></div></div></td></tr><tr><td><div><div><p>Outbound Header Map</p></div></div></td><td><div><div><p>List of header names or regular expressions (comma separated) to be removed at the end of the message processing, for example, <code>Access-Control-Allow-Credentials</code></p></div></div></td></tr><tr><td><div><div><p>Method &amp; Resource conditions</p></div></div></td><td><div><div><p>The option to add configurations to only a select few or all methods and resources of the API</p></div></div></td></tr></tbody></table>

## How This Policy Works

Because every header that matches a Header Removal policy parameter is removed from the message, you
must be careful about how you configure that parameter.

For example, the following parameter configuration removes any header starting with the word
`Access-Control`, such as the `Access-Control-Allow-Credentials` and `Access-Control-Allow-Origin`
headers from a message. The configuration also removes the `Cache-Control` header:

![Removed headers at the start of message processing](/mulesoft/current/en-us/mule-gateway/_images/remove-inbound-header.png)

Figure 1. Inbound Header
