# Request Headers in Cloud Functions

> [!NOTE]
> **Note:** Cloud Functions (2nd gen) is now Cloud Run functions. The information on this page applies to using the Cloud Functions API, which is still supported for performing operations on functions.

An incoming HTTP request includes the HTTP headers sent by the client. Use this
reference page for details about how these HTTP headers are processed in
Cloud Functions requests.

## Headers removed from incoming requests

For security purposes, some headers are sanitized or amended by intermediate
proxies before they reach your function.

Headers with names that match the `X-Google-*` pattern are removed from
incoming requests if a client sends them. This name pattern is reserved for use
by Google.

In addition, the following headers are removed from incoming requests because
they relate to the transfer of HTTP data between the client and server:

- `Connection`
- `Keep-Alive`
- `Proxy-Authorization`
- `TE`
- `Trailer`
- `Transfer-Encoding`

> [!NOTE]
> **Note:** Entity headers (headers relating to the request body) are not sanitized or checked, so functions should not rely on them. In particular, the `Content-MD5` request header is sent unmodified to the function, so it might not match the MD5 hash of the content. Also, the `Content-Encoding` request header is not checked by the server, so if the client sends a gzipped request body, it will be sent in compressed form to the application.

## Headers added for your use

Cloud Functions adds the following headers to all requests:

### `X-Cloud-Trace-Context`

A unique identifier for the request used for [Cloud Trace](https://docs.cloud.google.com/trace/docs.md.txt)
and [Cloud Logging](https://docs.cloud.google.com/logging/docs.md.txt). For example: `"65011637f09e0a5179677a7429456db7/1027871334010811884;o=1"`

### `X-Forwarded-For`

A comma-delimited list of IP addresses through which the client request has
been routed. The first IP in this list is generally the IP of the client that
created the request. The subsequent IPs provide information about proxy servers
that also handled the request before it reached the application server. For
example:

        X-Forwarded-For: clientIp, proxy1Ip, proxy2Ip

### `X-Forwarded-Proto`

Shows `http` or `https` based on the protocol the client used to connect to
your application.

The Google Cloud Load Balancer terminates all `https` connections, and then
forwards traffic to Cloud Functions over `http`. For example,
if the request is sent to:

```bash
https://YOUR_PROJECT_ID.cloudfunctions.net/YOUR_FUNCTION_NAME
```

the `X-Forwarded-Proto` header value is `https`.