You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/fundamentals/reference/http-request-headers.mdx
+8-17Lines changed: 8 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,15 @@
1
1
---
2
2
pcx_content_type: reference
3
3
title: Cloudflare HTTP request headers
4
-
5
4
---
6
5
7
-
import { Render } from"~/components"
6
+
import { Render } from"~/components";
8
7
9
8
Cloudflare passes all HTTP request headers to your origin web server and adds additional headers as specified below.
10
9
11
10
:::note
12
11
13
-
Cloudflare may remove HTTP request headers with names considered invalid [according to NGINX](https://nginx.org/en/docs/http/ngx_http_core_module.html#ignore_invalid_headers) — for example, header names containing a `.` (dot) character.
12
+
Cloudflare may remove HTTP request headers with names considered invalid [according to NGINX](https://nginx.org/en/docs/http/ngx_http_core_module.html#ignore_invalid_headers) — for example, header names containing a `.` (dot) character.
14
13
:::
15
14
16
15
## Accept-Encoding
@@ -40,7 +39,7 @@ When no Worker subrequest is triggered, `cf-connecting-ip` reflects the client's
40
39
41
40
Cloudflare provides [free IPv6 support](/network/ipv6-compatibility/) to all domains without requiring additional configuration or hardware. To support migrating to IPv6, Cloudflare's [Pseudo IPv4](/network/pseudo-ipv4/) provides an IPv6 to IPv4 translation service for all Cloudflare domains.
42
41
43
-
<Renderfile="pseudo-ipv4-warning" /> <br/>
42
+
<Renderfile="pseudo-ipv4-warning" /> <br/>
44
43
45
44
## CF-EW-Via
46
45
@@ -62,10 +61,8 @@ Alternatively, if you do not wish to receive the `True-Client-IP` header or any
62
61
63
62
:::caution
64
63
65
-
66
64
If you are using Cloudflare in a stacked CDN and authenticating HTTP requests based on the IP address value in the `True-Client-IP` header, you must add a `True-Client-IP` header to your requests. If you do not add this header, its value can be spoofed to any value.
67
65
68
-
69
66
:::
70
67
71
68
## X-Forwarded-For
@@ -80,10 +77,8 @@ If you do not wish to receive the visitor's IP address in the `X-Forwarded-For`
80
77
81
78
:::note
82
79
83
-
84
80
To restore the original visitor IP address at your origin web server, Cloudflare recommends that your logs or applications look at `CF-Connecting-IP` or `True-Client-IP` instead of `X-Forwarded-For`. `CF-Connecting-IP` and `True-Client-IP` both have a consistent format containing only one IP address.
85
81
86
-
87
82
:::
88
83
89
84
## X-Forwarded-Proto
@@ -104,19 +99,17 @@ Enterprise customers can also see all requests via [Cloudflare Logs](/logs/).
104
99
105
100
The `CF-IPCountry` header contains a two-character country code of the originating visitor’s country.
106
101
107
-
Besides the [ISO-3166-1 alpha-2 codes](https://www.iso.org/iso-3166-country-codes.html), Cloudflare uses the following special country codes:
102
+
Besides the [ISO-3166-1 alpha-2 codes](https://www.iso.org/iso-3166-country-codes.html), Cloudflare uses the following special country codes:
108
103
109
-
*`XX` - Used for clients without country code data.
110
-
*`T1` - Used for clients using the Tor network.
104
+
-`XX` - Used for clients without country code data.
105
+
-`T1` - Used for clients using the Tor network.
111
106
112
107
To add this header to requests, along with other HTTP headers with location information for the visitor's IP address, [enable the **Add visitor location headers** Managed Transform](/rules/transform/managed-transforms/configure/).
113
108
114
109
:::note
115
110
116
-
117
111
The `CF-IPCountry` header is removed from requests made from a Worker to an origin that is not proxied behind Cloudflare.
118
112
119
-
120
113
:::
121
114
122
115
## CF-Visitor
@@ -141,10 +134,8 @@ The intended purpose of this header is to provide a means for recipients (for ex
141
134
142
135
:::note
143
136
144
-
145
137
When configuring WAF custom rules, do not match on this header. These rules are applied before Cloudflare adds the `CF-Worker` header. Instead, use the [`cf.worker.upstream_zone`](/ruleset-engine/rules-language/fields/dynamic-fields/#cfworkerupstream_zone) dynamic field, which contains the same value and exists for the same purpose.
146
138
147
-
148
139
:::
149
140
150
141
## Connection
@@ -155,5 +146,5 @@ For incoming requests, the value of this header will always be set to `Keep-Aliv
155
146
156
147
When using Spectrum with a TCP application, these headers are not visible at the origin as they are HTTP headers. If you wish to utilize these in your application, there are two options:
157
148
158
-
* Use an HTTP or HTTPS Spectrum app instead of TCP
159
-
* Use the [Proxy Protocol feature](/spectrum/how-to/enable-proxy-protocol/)
149
+
- Use an HTTP or HTTPS Spectrum app instead of TCP
150
+
- Use the [Proxy Protocol feature](/spectrum/how-to/enable-proxy-protocol/)
If your origin server responds to a Cloudflare request using Gzip/Brotli compression, we will keep the same compression in the response sent to the website visitor if:
140
+
If your origin server responds to a Cloudflare request using Brotli/Gzip compression, we will keep the same compression in the response sent to the website visitor if:
141
141
142
-
- You include a `content-encoding` header in your server response mentioning the compression being used (`gzip` or `br`).
142
+
- You include a `content-encoding` header in your server response mentioning the compression being used (`br` or `gzip`).
143
143
- The visitor browser (or client) supports the compression algorithm.
144
144
- You do not enable Cloudflare features that change the response content (refer to [Notes about end-to-end compression](#notes-about-end-to-end-compression) for details).
145
145
146
-
Cloudflare's reverse proxy can also convert between compressed formats and uncompressed formats. Cloudflare can receive content from your origin server with Gzip or Brotli compression and serve it to visitors uncompressed (or vice versa), independently of caching.
146
+
Cloudflare's reverse proxy can also convert between compressed formats and uncompressed formats. Cloudflare can receive content from your origin server with Brotli or Gzip compression and serve it to visitors uncompressed (or vice versa), independently of caching.
147
147
148
-
If you do not want a particular response from your origin to be encoded with Gzip/Brotli when delivered to website visitors, you can disable this by including a `cache-control: no-transform` HTTP header in the response from your origin web server.
148
+
If you do not want a particular response from your origin to be encoded with Brotli/Gzip when delivered to website visitors, you can disable this by including a `cache-control: no-transform` HTTP header in the response from your origin web server.
149
149
150
150
:::caution
151
-
Cloudflare will take into consideration the `accept-encoding` header value in website visitors' requests when sending responses to those visitors. However, when requesting content from your origin server, Cloudflare will send a different `Accept-Encoding` header, supporting Gzip and Brotli compression.
151
+
Cloudflare will take into consideration the `accept-encoding` header value in website visitors' requests when sending responses to those visitors. However, when requesting content from your origin server, Cloudflare will send a different `Accept-Encoding` header, supporting Brotli and Gzip compression.
0 commit comments