Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ In this example, you run an A/B test controlled by a cookie named `ab-test` (wit
2. Select **Create new Snippet** and name it `ab-test-caching`.
3. Paste the following code. It modifies the cache key based on the `ab-test` cookie and caches the response for 30 days.

```JavaScript
```js
const CACHE_DURATION = 30 * 24 * 60 * 60; // 30 days

export default {
Expand Down Expand Up @@ -166,7 +166,7 @@ For complex caching scenarios, [Cloudflare Workers](/cache/interaction-cloudflar

This Worker detects whether a visitor is on a mobile or desktop device and creates separate cache entries for each, ensuring the correct version of the site is served and cached.

```JavaScript
```js
export default {
async fetch(request, env, ctx) {
const userAgent = request.headers.get('User-Agent') || '';
Expand Down Expand Up @@ -201,7 +201,7 @@ Free and Paid plans

This Worker detects if a visitor is on a mobile device or a desktop and creates a separate cache entry for each, ensuring the correct version of the site is served and cached. Uses the Enterprise `cf.customCacheKey` feature.

```JavaScript
```js
export default {
async fetch(request) {
// 1. Determine the device type from the User-Agent header
Expand Down
25 changes: 15 additions & 10 deletions src/content/docs/speed/optimization/protocol/http2-to-origin.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
---
pcx_content_type: how-to
title: HTTP/2 to Origin

---

import { FeatureTable, Details, Render, APIRequest, Dashboard, DashButton } from "~/components"
import {
FeatureTable,
Details,
Render,
APIRequest,
DashButton,
} from "~/components";

A protocol is a set of rules governing the exchange or transmission of data between devices. One of the most important protocols that run on the human-computer interaction layer, where applications can access the network services, is HTTP (Hypertext Transfer Protocol).

Expand All @@ -24,7 +29,7 @@ If you wish to disable HTTP/2 to Origin, you can follow these steps:

<DashButton url="/?to=/:account/:zone/speed/optimization" />

4. Go to the **Protocol Optimization** tab and under **HTTP/2 to Origin** set the toggle to **Off**.
2. Go to the **Protocol Optimization** tab and under **HTTP/2 to Origin** set the toggle to **Off**.

## Connection multiplexing

Expand All @@ -39,21 +44,21 @@ Connection multiplexing is enabled by default on Free, Pro and Business zones an
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/login) and select your account.
2. Choose the domain that will use HTTP/2 to Origin.
3. Select **Speed > Optimization**.
4. Open the **Protocol Optimization** tab.
4. Open the **Protocol Optimization** tab.
5. Under **HTTP/2 to Origin**, select **Configure** and adjust the stream settings as needed.

</Details>

<Details header="API">

<APIRequest
path="/zones/{zone_id}/settings/origin_h2_max_streams"
method="PATCH"
json={{
value: 100
}}
path="/zones/{zone_id}/settings/origin_h2_max_streams"
method="PATCH"
json={{
value: 100,
}}
/>

Refer to the [API documentation](/api/python/resources/zones/subresources/settings/methods/edit/) for more information.

</Details>
Expand Down
Loading