diff --git a/src/content/docs/fundamentals/reference/http-request-headers.mdx b/src/content/docs/fundamentals/reference/http-request-headers.mdx index 486b62cb218649..3bb2535ee54cb7 100644 --- a/src/content/docs/fundamentals/reference/http-request-headers.mdx +++ b/src/content/docs/fundamentals/reference/http-request-headers.mdx @@ -1,16 +1,15 @@ --- pcx_content_type: reference title: Cloudflare HTTP request headers - --- -import { Render } from "~/components" +import { Render } from "~/components"; Cloudflare passes all HTTP request headers to your origin web server and adds additional headers as specified below. :::note -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. +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. ::: ## Accept-Encoding @@ -40,7 +39,7 @@ When no Worker subrequest is triggered, `cf-connecting-ip` reflects the client's 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. -
+
## CF-EW-Via @@ -62,10 +61,8 @@ Alternatively, if you do not wish to receive the `True-Client-IP` header or any :::caution - 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. - ::: ## X-Forwarded-For @@ -80,10 +77,8 @@ If you do not wish to receive the visitor's IP address in the `X-Forwarded-For` :::note - 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. - ::: ## X-Forwarded-Proto @@ -104,19 +99,17 @@ Enterprise customers can also see all requests via [Cloudflare Logs](/logs/). The `CF-IPCountry` header contains a two-character country code of the originating visitor’s country. -Besides the [ISO-3166-1 alpha-2 codes](https://www.iso.org/iso-3166-country-codes.html), Cloudflare uses the following special country codes: +Besides the [ISO-3166-1 alpha-2 codes](https://www.iso.org/iso-3166-country-codes.html), Cloudflare uses the following special country codes: -* `XX` - Used for clients without country code data. -* `T1` - Used for clients using the Tor network. +- `XX` - Used for clients without country code data. +- `T1` - Used for clients using the Tor network. 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/). :::note - The `CF-IPCountry` header is removed from requests made from a Worker to an origin that is not proxied behind Cloudflare. - ::: ## CF-Visitor @@ -141,10 +134,8 @@ The intended purpose of this header is to provide a means for recipients (for ex :::note - 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. - ::: ## Connection @@ -155,5 +146,5 @@ For incoming requests, the value of this header will always be set to `Keep-Aliv 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: -* Use an HTTP or HTTPS Spectrum app instead of TCP -* Use the [Proxy Protocol feature](/spectrum/how-to/enable-proxy-protocol/) +- Use an HTTP or HTTPS Spectrum app instead of TCP +- Use the [Proxy Protocol feature](/spectrum/how-to/enable-proxy-protocol/) diff --git a/src/content/docs/speed/optimization/content/brotli/content-compression.mdx b/src/content/docs/speed/optimization/content/brotli/content-compression.mdx index 5595fdf6a4619b..cb5dc97920ea90 100644 --- a/src/content/docs/speed/optimization/content/brotli/content-compression.mdx +++ b/src/content/docs/speed/optimization/content/brotli/content-compression.mdx @@ -116,19 +116,19 @@ Smaller responses will not be compressed, regardless of their content type. ## Content compression from origin servers to the Cloudflare network -When requesting content from your origin server, Cloudflare supports Gzip compression, Brotli compression, or no compression. +When requesting content from your origin server, Cloudflare supports Brotli compression, Gzip compression, or no compression. ```mermaid flowchart LR accTitle: Compressed responses sent from the origin server -accDescr: Cloudflare accepts responses from origin server using Gzip compression, Brotli compression, or no compression. +accDescr: Cloudflare accepts responses from origin server using Brotli compression, Gzip compression, or no compression. A[Visitor browser] B((Cloudflare)) C[(Origin server)] -A -.-> B == "Request
Accept-Encoding: gzip, br" ==> C -C == "Response
(Gzip / Brotli / No compression)" ==> B -.-> A +A -.-> B == "Request
Accept-Encoding: br, gzip" ==> C +C == "Response
(Brotli / Gzip / No compression)" ==> B -.-> A style A stroke-dasharray: 5 5 style B stroke: orange,fill: orange,color: black @@ -137,18 +137,18 @@ linkStyle 1,2 stroke-width: 2px linkStyle 0,3 stroke-width: 1px ``` -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: +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: -- You include a `content-encoding` header in your server response mentioning the compression being used (`gzip` or `br`). +- You include a `content-encoding` header in your server response mentioning the compression being used (`br` or `gzip`). - The visitor browser (or client) supports the compression algorithm. - 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). -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. +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. -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. +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. :::caution -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. +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. ::: ---