> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Request Header Collection

AppSignal collects headers for HTTP requests by default for supported frameworks. This data may help track down errors or performance issues that were caused by request header data a client is sending. In compliance with GDPR, AppSignal collects a minimal amount of headers by default.
To comply with [GDPR](/appsignal/gdpr) rules, collecting no user identifiable data, AppSignal collects a very limited amount of headers by default.

To further limit the collection of header data, you can configure which headers AppSignal collects.

<Tip>
  Read more about request header filtering and what types of headers to set up
  filtering for in our [Request Header Collection][header filtering]
  documentation.
</Tip>

<Warning>
  🔐 Do not send <strong>Personal Identifiable Information (PII)</strong> to AppSignal. Filter PII (e.g., names, emails) and use an ID, hash, or pseudonymized identifier instead. <br /> <br /> For <strong>HIPAA-covered entities</strong>, more info on signing a Business Associate Agreement (BAA) is available in our <a href="/support/business-add-ons">Business Add-Ons documentation</a>.
</Warning>

## Configure Headers

An application's session data can be filtered by configuring keys in an *allowlist*. This allowlist system will filter out all the session data keys not in this list.

AppSignal does not collect the name or value of headers filtered out by your allowlist.

### Example

For example, an application with this AppSignal config:

<CodeGroup>
  ```yaml YAML theme={null}
  request_headers: ["Request-Method"]
  ```
</CodeGroup>

Will only send the `Request-Method` header to AppSignal.com.

This guide will show you how to configure your application's request header filtering allowlist based on what language your application uses:

* [Ruby](#ruby)
* [Elixir](#elixir)
* [Node.js](#nodejs)
* [Python](#python)
* [Go](#go)
* [Java](#java)
* [PHP](#php)

## Ruby

AppSignal automatically stores the configured request headers in the Ruby integration for Rails apps and other frameworks.
It has a built-in list of request headers to collect by default that you can customize with the [`request_headers`][ruby request headers] config option.

* [Default List of Request Headers][ruby request headers]

To configure which request headers to collect for each request, add the following configuration to your `config/appsignal.yml` file in the environment group where
you want it to apply. The [`request_headers`][ruby request headers]

<CodeGroup>
  ```ruby Ruby theme={null}
  Appsignal.configure do |config|
    config.request_headers += ["ADDITONAL_CUSTOM_HEADER", "EXTRA_HEADER"]
  end
  ```

  ```yaml YAML theme={null}
  production:
    request_headers: # Example list of headers
      - PATH_INFO
      - REQUEST_METHOD
      - REQUEST_PATH
      - SERVER_NAME
      - SERVER_PORT
      - SERVER_PROTOCOL
  ```
</CodeGroup>

## Elixir

AppSignal automatically stores the configured request headers for Phoenix apps and other frameworks in the Elixir integration.
It has a built-in list of request headers collected by default which you can customize using the [request\_headers][elixir request headers] config option.

* [Default list of request headers][elixir request headers]

To configure which request headers to collect for each request, add the following configuration to your `config/appsignal.exs` file in the environment group where you want it to apply. The [request\_headers][elixir request headers] value is a list of strings.

<CodeGroup>
  ```yaml YAML theme={null}
  config :appsignal, :config,
    request_headers: ~w(
      path-info request-method request-uri server-name server-port server-protocol
    ) # Example list of headers
  ```
</CodeGroup>

## Node.js

In the Node.js integration, AppSignal automatically stores the configured request headers for Express apps and other frameworks. It has a built-in list of request headers to collect by default that you can customize with the [requestHeaders][node request headers] config option.

* [Default list of request headers][node request headers]

To configure which request headers to collect for each request, add the following configuration to your AppSignal client instance creation. The [requestHeaders][node request headers] value is an array of strings.

<CodeGroup>
  ```javascript Node.js theme={null}
  const { Appsignal } = require("@appsignal/nodejs");

  new Appsignal({
    requestHeaders: ["accept", "cache-control", "content-length", "range"],
  });
  ```
</CodeGroup>

## Python

In the Python integration, if an app sets request headers, AppSignal will automatically collect the configured request headers. It has a built-in list of request headers to collect by default that you can customize with the [request\_headers][python request headers] config option.

* [Default list of request headers][python request headers]

To configure which request headers to collect for each request, add the following configuration to your AppSignal client instance creation. The [`request_headers`][python request headers] value is a list of strings.

<CodeGroup>
  ```python Python theme={null}
  from appsignal import Appsignal

  appsignal = Appsignal(
      # Other config
      request_headers: ["accept", "cache-control", "content-length", "range"],
  )
  ```
</CodeGroup>

## Go

If an app records request headers, AppSignal will automatically filter the configured request headers. It has a built-in list of request headers to collect by default that you can customize with the [`request_headers` config option][go request headers].

* [Default list of request headers][go request headers]

See the [Go configuration page](/go/configuration/options) for more information on how to configure OpenTelemetry for Go apps.

To configure which request headers to collect for each request, add the following configuration to your AppSignal client instance creation. The [`request_headers`][go request headers] value is a slice of strings.

<CodeGroup>
  ```go Go theme={null}
  res := resource.NewWithAttributes(
  	// Only send these specific headers
  	attribute.StringSlice("appsignal.config.request_headers", []string{"accept", "request_method", "content_length"}),

  	// Do not send any headers
  	attribute.StringSlice("appsignal.config.request_headers", []string{}),
  )
  ```
</CodeGroup>

## Java

In the Java integration, if an app sets request headers, AppSignal will automatically collect the configured request headers. It has a built-in list of request headers to collect by default that you can customize with the [`request_headers`][java request headers] config option.

* [Default list of request headers][java request headers]

To configure which request headers to collect for each request, add the following configuration. The [`request_headers`][java request headers] value is an array of strings.

<CodeGroup>
  ```bash Bash theme={null}
  function encode() {
    echo -n "$@" | sed 's/,/%2C/g'
  }

  export OTEL_RESOURCE_ATTRIBUTES="\
    appsignal.config.request_headers=$(encode "accept,cache-control,content-length,range"),\
    ..."

  # Do not send any headers
  export OTEL_RESOURCE_ATTRIBUTES="\
    appsignal.config.request_headers=,\
    ..."
  ```
</CodeGroup>

## PHP

In the PHP integration, if an app sets request headers, AppSignal will automatically collect the configured request headers. It has a built-in list of request headers to collect by default that you can customize with the [`request_headers`][php request headers] config option.

* [Default list of request headers][php request headers]

To configure which request headers to collect for each request, add the following configuration. The [`request_headers`][php request headers] value is an array of strings.

<CodeGroup>
  ```php PHP theme={null}
  return [
      // Send selected headers
      'request_headers' => ['accept', 'cache-control', 'content-length', 'range'],

      // Do not send any headers
      'request_headers' => [],

      // ... other options
  ];
  ```
</CodeGroup>

[disabled entirely]: /application/header-filtering.html#filter-all-request-headers

[elixir request headers]: /elixir/configuration/options.html#option-request_headers

[header filtering]: /application/header-filtering.html

[node request headers]: /nodejs/3.x/configuration/options.html#option-requestheaders

[ruby request headers]: /ruby/configuration/options.html#option-request_headers

[python request headers]: /python/configuration/options.html#option-request_headers

[go request headers]: /go/configuration/options.html#option-request_headers

[java request headers]: /java/configuration/options.html#option-request_headers

[php request headers]: /php/configuration/options.html#option-request_headers
