Skip to content

Commit 0ee2a43

Browse files
authored
Merge branch 'production' into kian/PCX-16495
2 parents dd86337 + 44189f0 commit 0ee2a43

File tree

7 files changed

+100
-9
lines changed

7 files changed

+100
-9
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"react-icons": "5.5.0",
9494
"react-instantsearch": "7.15.4",
9595
"react-markdown": "10.1.0",
96-
"redirects-in-workers": "0.0.5",
96+
"redirects-in-workers": "0.0.7",
9797
"rehype": "13.0.2",
9898
"rehype-autolink-headings": "7.1.0",
9999
"rehype-external-links": "3.0.0",

public/__redirects

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@
123123
/ai-gateway/integration/ /ai-gateway/integrations/ 301
124124
/ai-gateway/providers/open-router/ /ai-gateway/providers/openrouter/ 301
125125

126+
# agents
127+
/agents/capabilities/mcp-server/ /agents/model-context-protocol/ 301
128+
126129
# analytics
127130
/analytics/migration-guides/zone-analytics/ /analytics/graphql-api/migration-guides/zone-analytics/ 301
128131
/analytics/web-analytics/about/ /web-analytics/about 301
@@ -824,6 +827,7 @@
824827
/pages/how-to/deploy-a-jekyll-site/ /pages/framework-guides/deploy-a-jekyll-site/ 301
825828
/pages/how-to/deploy-a-nextjs-site/ /pages/framework-guides/nextjs/ 301
826829
/pages/framework-guides/deploy-a-nextjs-site/ /pages/framework-guides/nextjs/ 301
830+
/pages/framework-guides/deploy-a-svelte-site/ /pages/framework-guides/deploy-a-svelte-kit-site/ 301
827831
/pages/framework-guides/nextjs/deploy-a-nextjs-site/ /pages/framework-guides/nextjs/ssr/get-started/ 301
828832
/pages/how-to/deploy-anything/ /pages/framework-guides/deploy-anything/ 301
829833
/pages/how-to/deploy-a-react-application/ /pages/framework-guides/deploy-a-react-site/ 301
@@ -1113,6 +1117,7 @@
11131117
/support/third-party-software/content-management-system-cms/how-do-i-use-wordpress-multi-site-wpmu-with-cloudflare/ /automatic-platform-optimization/ 301
11141118
/support/third-party-software/content-management-system-cms/modified_drupal/ /support/third-party-software/content-management-system-cms/caching-html-with-drupal/ 301
11151119
/support/third-party-software/content-management-system-cms/using-cloudflare-with-wix-website-builder/ /dns/manage-dns-records/reference/vendor-specific-records/#wix 301
1120+
/support/third-party-software/content-management-system-cms/wordpress.com-and-cloudflare/ /support/third-party-software/content-management-system-cms/wordpresscom-and-cloudflare/ 301
11161121
/support/more-dashboard-apps/cloudflare-scrape-shield/what-does-scrape-shield-do/ /waf/tools/scrape-shield/ 301
11171122
/support/third-party-software/others/how-do-i-get-cloudflare-to-work-with-vaultpress/ /automatic-platform-optimization/ 301
11181123
/support/third-party-software/others/can-i-use-cloudflare-and-varnish-together/ /rules/snippets/ 301
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
import { z } from "astro:schema";
3+
import { Code } from "@astrojs/starlight/components";
4+
import Details from "~/components/Details.astro";
5+
6+
type Props = z.infer<typeof props>;
7+
8+
const props = z.object({
9+
name: z.string(),
10+
});
11+
12+
const { name } = props.parse(Astro.props);
13+
14+
const worker = `
15+
export interface Env {
16+
AI: Ai;
17+
}
18+
19+
export default {
20+
async fetch(request, env): Promise<Response> {
21+
const query = 'Which one is cooler?'
22+
const contexts = [
23+
{
24+
text: 'a cyberpunk lizzard'
25+
},
26+
{
27+
text: 'a cyberpunk cat'
28+
}
29+
];
30+
31+
const response = await env.AI.run('${name}', { query, contexts });
32+
33+
return Response.json(response);
34+
},
35+
} satisfies ExportedHandler<Env>;
36+
37+
`;
38+
39+
const python = `
40+
import os
41+
import requests
42+
43+
ACCOUNT_ID = "your-account-id"
44+
AUTH_TOKEN = os.environ.get("CLOUDFLARE_AUTH_TOKEN")
45+
46+
response = requests.post(
47+
f"https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/run/${name}",
48+
headers={"Authorization": f"Bearer {AUTH_TOKEN}"},
49+
json={
50+
"query": "Which one is better?"
51+
"context": [
52+
{"text": "a cyberpunk lizzard"},
53+
{"text": "a cyberpunk car"},
54+
]
55+
}
56+
)
57+
result = response.json()
58+
print(result)
59+
`;
60+
61+
const curl = `
62+
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
63+
-X POST \\
64+
-H "Authorization: Bearer $CLOUDFLARE_AUTH_TOKEN" \\
65+
-d '{ "query": "Which one is better?", "contexts": [{ "text": "a cyberpunk lizzard" }, {"text": "a cyberpunk cat"}]}'
66+
`;
67+
---
68+
69+
<Details header="Worker">
70+
<Code code={worker} lang="ts" />
71+
</Details>
72+
73+
<Details header="Python">
74+
<Code code={python} lang="py" />
75+
</Details>
76+
77+
<Details header="curl">
78+
<Code code={curl} lang="sh" />
79+
</Details>

src/content/changelog/workers/2025-03-22-next-js-vulnerability-waf.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ We've made a WAF (Web Application Firewall) rule available to all sites on Cloud
6060
**Note**: This rule is not enabled by default as it blocked requests across sites for specific authentication middleware.
6161

6262
* This managed rule protects sites using Next.js on Workers and Pages, as well as sites using Cloudflare to protect Next.js applications hosted elsewhere.
63-
* This rule has been made avaiable (but not enabled by default) to all sites as part of our [WAF Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/) and blocks requests that attempt to bypass authentication in Next.js applications.
63+
* This rule has been made available (but not enabled by default) to all sites as part of our [WAF Managed Ruleset](/waf/managed-rules/reference/cloudflare-managed-ruleset/) and blocks requests that attempt to bypass authentication in Next.js applications.
6464
* The vulnerability affects almost all Next.js versions, and is patched in Next.js `14.2.25` and `15..2.3`. **Users on older versions of Next.js (`11.1.4` to `13.5.6`) do not have a patch available**.
6565

6666
The managed WAF rule mitigates this by blocking _external_ user requests with the `x-middleware-subrequest` header regardless of Next.js version, but we recommend users using Next.js 14 and 15 upgrade to the patched versions of Next.js as an additional mitigation.

src/pages/workers-ai/models/[name].astro

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import StableDiffusionV15InpaintingCode from "~/components/models/code/StableDif
2424
import Flux1Schnell from "~/components/models/code/Flux-1-Schnell.astro";
2525
import WhisperBase64Code from "~/components/models/code/WhisperBase64Code.astro";
2626
import LlamaGuard from "~/components/models/code/LlamaGuard.astro";
27+
import BgeRerankerBase from "~/components/models/code/Bge-Reranker-Base.astro";
2728
2829
import { authorData } from "~/components/models/data";
2930
@@ -98,6 +99,10 @@ if (model.name === "@cf/meta/llama-guard-3-8b") {
9899
CodeExamples = LlamaGuard;
99100
}
100101
102+
if (model.name === "@cf/baai/bge-reranker-base") {
103+
CodeExamples = BgeRerankerBase;
104+
}
105+
101106
const description = model.description;
102107
103108
const isBeta = model.properties.find(

worker/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import remarkGfm from "remark-gfm";
1212
import rehypeRemark from "rehype-remark";
1313
import remarkStringify from "remark-stringify";
1414

15-
const redirectsEvaluator = generateRedirectsEvaluator(redirectsFileContents);
15+
const redirectsEvaluator = generateRedirectsEvaluator(redirectsFileContents, {
16+
maxLineLength: 10_000, // Usually 2_000
17+
maxStaticRules: 10_000, // Usually 2_000
18+
maxDynamicRules: 2_000, // Usually 100
19+
});
1620

1721
export default class extends WorkerEntrypoint<Env> {
1822
override async fetch(request: Request) {
@@ -57,7 +61,6 @@ export default class extends WorkerEntrypoint<Env> {
5761

5862
try {
5963
try {
60-
// @ts-expect-error Ignore Fetcher type mismatch
6164
const redirect = await redirectsEvaluator(request, this.env.ASSETS);
6265
if (redirect) {
6366
return redirect;
@@ -73,7 +76,6 @@ export default class extends WorkerEntrypoint<Env> {
7376
);
7477
const redirect = await redirectsEvaluator(
7578
new Request(forceTrailingSlashURL, request),
76-
// @ts-expect-error Ignore Fetcher type mismatch
7779
this.env.ASSETS,
7880
);
7981
if (redirect) {

0 commit comments

Comments
 (0)