Skip to content

Commit cb15868

Browse files
KianNHwindsurf-bot[bot]
authored andcommitted
[Docs Site] Attempt to redirect index.md files (cloudflare#22831)
* [Docs Site] Attempt to redirect index.md files * Update worker/index.ts Co-authored-by: windsurf-bot[bot] <189301087+windsurf-bot[bot]@users.noreply.github.com> * use Response.redirect static method * fixup dynamic redirects, fix worker logic, add test --------- Co-authored-by: windsurf-bot[bot] <189301087+windsurf-bot[bot]@users.noreply.github.com>
1 parent 1838d72 commit cb15868

File tree

4 files changed

+101
-75
lines changed

4 files changed

+101
-75
lines changed

public/__redirects

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,6 @@
712712
/fundamentals/setup/account/customize-account/communication-preference/ /fundamentals/account/customize-account/ 301
713713
/fundamentals/setup/account/customize-account/language-preference/ /fundamentals/account/customize-account/ 301
714714
/fundamentals/setup/ /fundamentals/account/ 301
715-
/fundamentals/setup/account/* /fundamentals/account/:splat 301
716-
/fundamentals/setup/manage-domains/* /fundamentals//manage-domains/:splat 301
717-
/fundamentals/setup/manage-members/* /fundamentals/manage-members/:splat 301
718715

719716
# gateway
720717
/gateway/about/ /cloudflare-one/policies/gateway/ 301
@@ -828,6 +825,74 @@
828825
/learning-paths/clientless-access/ /learning-paths/clientless-access/concepts/ 301
829826
/learning-paths/application-security/default-traffic-security/security-level/ /learning-paths/application-security/default-traffic-security/browser-integrity/ 301
830827

828+
## Get started with Cloudflare --> fundamentals
829+
/learning-paths/get-started/concepts/ /fundamentals/ 301
830+
/learning-paths/get-started/concepts/what-is-cloudflare/ /fundamentals/ 301
831+
/learning-paths/get-started/concepts/how-cloudflare-works/ /fundamentals/concepts/how-cloudflare-works/ 301
832+
/learning-paths/get-started/concepts/traffic-flow-cloudflare/ /fundamentals/concepts/traffic-flow-cloudflare/ 301
833+
/learning-paths/get-started/concepts/cloudflare-ips/ /fundamentals/concepts/cloudflare-ip-addresses/ 301
834+
/learning-paths/get-started/account-setup/ /fundamentals/account/create-account/ 301
835+
/learning-paths/get-started/account-setup/create-account/ /fundamentals/account/create-account/ 301
836+
/learning-paths/get-started/account-setup/set-up-2fa/ /fundamentals/account/account-security/2fa/ 301
837+
/learning-paths/get-started/account-setup/customize-account/ /fundamentals/account/customize-account/account-name/ 301
838+
/learning-paths/get-started/account-setup/add-other-members/ /fundamentals/manage-members/ 301
839+
/learning-paths/get-started/account-setup/create-api-token/ /fundamentals/api/how-to/create-via-api/ 301
840+
/learning-paths/get-started/add-domain-to-cf/ /fundamentals/manage-domains/add-site/ 301
841+
/learning-paths/get-started/add-domain-to-cf/minimize-downtime/ /fundamentals/performance/minimize-downtime/ 301
842+
/learning-paths/get-started/add-domain-to-cf/allow-cloudflare-ips/ /fundamentals/concepts/cloudflare-ip-addresses/ 301
843+
/learning-paths/get-started/add-domain-to-cf/disable-dnssec/ /dns/dnssec/#disable-dnssec 301
844+
/learning-paths/get-started/add-domain-to-cf/add-site/ /fundamentals/manage-domains/add-site/ 301
845+
/learning-paths/get-started/add-domain-to-cf/update-nameservers/ /dns/zone-setups/full-setup/setup/#update-your-nameservers 301
846+
/learning-paths/get-started/domain-resolution/ /fundamentals/manage-domains/ 301
847+
/learning-paths/get-started/domain-resolution/review-dns-records/ /dns/zone-setups/full-setup/setup/#review-dns-records 301
848+
/learning-paths/get-started/domain-resolution/proxy-status/ /dns/proxy-status/ 301
849+
/learning-paths/get-started/domain-resolution/enable-dnssec/ /dns/dnssec/#enable-dnssec 301
850+
/learning-paths/get-started/domain-resolution/create-subdomain/ /fundamentals/manage-domains/manage-subdomains/ 301
851+
/learning-paths/get-started/domain-resolution/setup-email-records/ /dns/manage-dns-records/how-to/email-records/ 301
852+
/learning-paths/get-started/security/ /fundamentals/security/ 301
853+
/learning-paths/get-started/security/default-improvements/ /fundamentals/security/under-ddos-attack/ 301
854+
/learning-paths/get-started/security/ssl-tls/ /ssl/origin-configuration/ssl-modes/ 301
855+
/learning-paths/get-started/security/bot-fight-mode/ /bots/get-started/bot-fight-mode/ 301
856+
/learning-paths/get-started/security/secure-origin/ /fundamentals/security/protect-your-origin-server/ 301
857+
/learning-paths/get-started/security/security-center/ /security-center/ 301
858+
/learning-paths/get-started/security/add-on-products/ /products/?product-group=Application+security 301
859+
/learning-paths/get-started/security/security-settings/ /fundamentals/security/ 301
860+
/learning-paths/get-started/performance/ /fundamentals/performance/ 301
861+
/learning-paths/get-started/performance/default-improvements/ /fundamentals/performance/ 301
862+
/learning-paths/get-started/performance/optimize-caching/ /cache/get-started/ 301
863+
/learning-paths/get-started/performance/optimize-speed/ /speed/ 301
864+
/learning-paths/get-started/performance/web-analytics/ /web-analytics/ 301
865+
/learning-paths/get-started/performance/add-on-products/ /products/?product-group=Application+performance 301
866+
867+
## Get started free plan --> fundamentals
868+
/learning-paths/get-started-free/onboarding/ /fundamentals/ 301
869+
/learning-paths/get-started-free/onboarding/add-and-activate/ /fundamentals/manage-domains/add-site/ 301
870+
/learning-paths/get-started-free/onboarding/proxy-dns-records/ /dns/proxy-status/ 301
871+
/learning-paths/get-started-free/onboarding/check-dns/ /dns/zone-setups/full-setup/troubleshooting/ 301
872+
/learning-paths/get-started-free/onboarding/check-ssl/ /ssl/troubleshooting/ 301
873+
/learning-paths/get-started-free/performance/ /fundamentals/performance/ 301
874+
/learning-paths/get-started-free/performance/default-improvements/ /fundamentals/performance/ 301
875+
/learning-paths/get-started-free/performance/optimize-caching/ /cache/get-started/ 301
876+
/learning-paths/get-started-free/performance/optimize-speed/ /speed/ 301
877+
/learning-paths/get-started-free/performance/web-analytics/ /web-analytics/ 301
878+
/learning-paths/get-started-free/performance/add-on-products/ /products/?product-group=Application+security 301
879+
/learning-paths/get-started-free/security/ /fundamentals/security/ 301
880+
/learning-paths/get-started-free/security/default-improvements/ /fundamentals/security/under-ddos-attack/ 301
881+
/learning-paths/get-started-free/security/ssl-tls/ /ssl/origin-configuration/ssl-modes/ 301
882+
/learning-paths/get-started-free/security/dnssec/ /dns/dnssec/#enable-dnssec 301
883+
/learning-paths/get-started-free/security/security-settings/ /fundamentals/security/ 301
884+
/learning-paths/get-started-free/security/bot-fight-mode/ /bots/get-started/bot-fight-mode/ 301
885+
/learning-paths/get-started-free/security/security-center/ /security-center/ 301
886+
/learning-paths/get-started-free/security/add-on-products/ /products/?product-group=Application+security 301
887+
/learning-paths/get-started-free/other-features/ /fundamentals/ 301
888+
/learning-paths/get-started-free/other-features/rules/ /rules/ 301
889+
/learning-paths/get-started-free/other-features/redirects/ /fundamentals/reference/redirects/ 301
890+
/learning-paths/get-started-free/other-features/analytics/ /analytics/account-and-zone-analytics/ 301
891+
/learning-paths/get-started-free/other-features/account-profile/ /fundamentals/account/ 301
892+
/learning-paths/get-started-free/other-features/email-routing/ /email-routing/ 301
893+
/learning-paths/get-started-free/other-features/resources/ /fundamentals/#additional-resources 301
894+
/learning-paths/get-started-free/other-features/product-lines/ /products/ 301
895+
831896
# more redirects in the /dynamic/ section
832897

833898
# load-balancing
@@ -1717,9 +1782,8 @@
17171782
/workers-ai/markdown-conversion/ /workers-ai/features/markdown-conversion/ 301
17181783

17191784
# workflows
1720-
17211785
/workflows/reference/storage-options/ /workers/platform/storage-options/ 301
1722-
1786+
/workflows/tutorials/ /workflows/examples 301
17231787

17241788
# workers KV
17251789
/kv/platform/environments/ /kv/reference/environments/ 301
@@ -2014,6 +2078,9 @@
20142078
/firewall/recipes/* /waf/custom-rules/use-cases/:splat 301
20152079
/web3/polygon-gateway/* /web3/ 301
20162080
/vectorize/configuration/* /vectorize/best-practices/:splat 301
2081+
/fundamentals/setup/account/* /fundamentals/account/:splat 301
2082+
/fundamentals/setup/manage-domains/* /fundamentals/manage-domains/:splat 301
2083+
/fundamentals/setup/manage-members/* /fundamentals/manage-members/:splat 301
20172084

20182085
# Cloudflare One / Zero Trust
20192086
/cloudflare-one/connections/connect-networks/install-and-setup/tunnel-guide/local/as-a-service/* /cloudflare-one/connections/connect-networks/configure-tunnels/local-management/as-a-service/:splat 301
@@ -2057,72 +2124,6 @@
20572124
/learning-paths/secure-internet-traffic/connect-devices/* /learning-paths/secure-internet-traffic/connect-devices-networks/:splat 301
20582125
## Zero Trust Web Access --> Clientless Access
20592126
/learning-paths/zero-trust-web-access/* /learning-paths/clientless-access/:splat 301
2060-
## Get started with Cloudflare --> fundamentals
2061-
/learning-paths/get-started/concepts/ /fundamentals/ 301
2062-
/learning-paths/get-started/concepts/what-is-cloudflare/ /fundamentals/ 301
2063-
/learning-paths/get-started/concepts/how-cloudflare-works/ /fundamentals/concepts/how-cloudflare-works/ 301
2064-
/learning-paths/get-started/concepts/traffic-flow-cloudflare/ /fundamentals/concepts/traffic-flow-cloudflare/ 301
2065-
/learning-paths/get-started/concepts/cloudflare-ips/ /fundamentals/concepts/cloudflare-ip-addresses/ 301
2066-
/learning-paths/get-started/account-setup/ /fundamentals/account/create-account/ 301
2067-
/learning-paths/get-started/account-setup/create-account/ /fundamentals/account/create-account/ 301
2068-
/learning-paths/get-started/account-setup/set-up-2fa/ /fundamentals/account/account-security/2fa/ 301
2069-
/learning-paths/get-started/account-setup/customize-account/ /fundamentals/account/customize-account/account-name/ 301
2070-
/learning-paths/get-started/account-setup/add-other-members/ /fundamentals/manage-members/ 301
2071-
/learning-paths/get-started/account-setup/create-api-token/ /fundamentals/api/how-to/create-via-api/ 301
2072-
/learning-paths/get-started/add-domain-to-cf/ /fundamentals/manage-domains/add-site/ 301
2073-
/learning-paths/get-started/add-domain-to-cf/minimize-downtime/ /fundamentals/performance/minimize-downtime/ 301
2074-
/learning-paths/get-started/add-domain-to-cf/allow-cloudflare-ips/ /fundamentals/concepts/cloudflare-ip-addresses/ 301
2075-
/learning-paths/get-started/add-domain-to-cf/disable-dnssec/ /dns/dnssec/#disable-dnssec 301
2076-
/learning-paths/get-started/add-domain-to-cf/add-site/ /fundamentals/manage-domains/add-site/ 301
2077-
/learning-paths/get-started/add-domain-to-cf/update-nameservers/ /dns/zone-setups/full-setup/setup/#update-your-nameservers 301
2078-
/learning-paths/get-started/domain-resolution/ /fundamentals/manage-domains/ 301
2079-
/learning-paths/get-started/domain-resolution/review-dns-records/ /dns/zone-setups/full-setup/setup/#review-dns-records 301
2080-
/learning-paths/get-started/domain-resolution/proxy-status/ /dns/proxy-status/ 301
2081-
/learning-paths/get-started/domain-resolution/enable-dnssec/ /dns/dnssec/#enable-dnssec 301
2082-
/learning-paths/get-started/domain-resolution/create-subdomain/ /fundamentals/manage-domains/manage-subdomains/ 301
2083-
/learning-paths/get-started/domain-resolution/setup-email-records/ /dns/manage-dns-records/how-to/email-records/ 301
2084-
/learning-paths/get-started/security/ /fundamentals/security/ 301
2085-
/learning-paths/get-started/security/default-improvements/ /fundamentals/security/under-ddos-attack/ 301
2086-
/learning-paths/get-started/security/ssl-tls/ /ssl/origin-configuration/ssl-modes/ 301
2087-
/learning-paths/get-started/security/bot-fight-mode/ /bots/get-started/bot-fight-mode/ 301
2088-
/learning-paths/get-started/security/secure-origin/ /fundamentals/security/protect-your-origin-server/ 301
2089-
/learning-paths/get-started/security/security-center/ /security-center/ 301
2090-
/learning-paths/get-started/security/add-on-products/ /products/?product-group=Application+security 301
2091-
/learning-paths/get-started/security/security-settings/ /fundamentals/security/ 301
2092-
/learning-paths/get-started/performance/ /fundamentals/performance/ 301
2093-
/learning-paths/get-started/performance/default-improvements/ /fundamentals/performance/ 301
2094-
/learning-paths/get-started/performance/optimize-caching/ /cache/get-started/ 301
2095-
/learning-paths/get-started/performance/optimize-speed/ /speed/ 301
2096-
/learning-paths/get-started/performance/web-analytics/ /web-analytics/ 301
2097-
/learning-paths/get-started/performance/add-on-products/ /products/?product-group=Application+performance 301
2098-
## Get started free plan --> fundamentals
2099-
/learning-paths/get-started-free/onboarding/ /fundamentals/ 301
2100-
/learning-paths/get-started-free/onboarding/add-and-activate/ /fundamentals/manage-domains/add-site/ 301
2101-
/learning-paths/get-started-free/onboarding/proxy-dns-records/ /dns/proxy-status/ 301
2102-
/learning-paths/get-started-free/onboarding/check-dns/ /dns/zone-setups/full-setup/troubleshooting/ 301
2103-
/learning-paths/get-started-free/onboarding/check-ssl/ /ssl/troubleshooting/ 301
2104-
/learning-paths/get-started-free/performance/ /fundamentals/performance/ 301
2105-
/learning-paths/get-started-free/performance/default-improvements/ /fundamentals/performance/ 301
2106-
/learning-paths/get-started-free/performance/optimize-caching/ /cache/get-started/ 301
2107-
/learning-paths/get-started-free/performance/optimize-speed/ /speed/ 301
2108-
/learning-paths/get-started-free/performance/web-analytics/ /web-analytics/ 301
2109-
/learning-paths/get-started-free/performance/add-on-products/ /products/?product-group=Application+security 301
2110-
/learning-paths/get-started-free/security/ /fundamentals/security/ 301
2111-
/learning-paths/get-started-free/security/default-improvements/ /fundamentals/security/under-ddos-attack/ 301
2112-
/learning-paths/get-started-free/security/ssl-tls/ /ssl/origin-configuration/ssl-modes/ 301
2113-
/learning-paths/get-started-free/security/dnssec/ /dns/dnssec/#enable-dnssec 301
2114-
/learning-paths/get-started-free/security/security-settings/ /fundamentals/security/ 301
2115-
/learning-paths/get-started-free/security/bot-fight-mode/ /bots/get-started/bot-fight-mode/ 301
2116-
/learning-paths/get-started-free/security/security-center/ /security-center/ 301
2117-
/learning-paths/get-started-free/security/add-on-products/ /products/?product-group=Application+security 301
2118-
/learning-paths/get-started-free/other-features/ /fundamentals/ 301
2119-
/learning-paths/get-started-free/other-features/rules/ /rules/ 301
2120-
/learning-paths/get-started-free/other-features/redirects/ /fundamentals/reference/redirects/ 301
2121-
/learning-paths/get-started-free/other-features/analytics/ /analytics/account-and-zone-analytics/ 301
2122-
/learning-paths/get-started-free/other-features/account-profile/ /fundamentals/account/ 301
2123-
/learning-paths/get-started-free/other-features/email-routing/ /email-routing/ 301
2124-
/learning-paths/get-started-free/other-features/resources/ /fundamentals/#additional-resources 301
2125-
/learning-paths/get-started-free/other-features/product-lines/ /products/ 301
21262127

21272128
# Cloudflare for SaaS
21282129
/ssl/ssl-for-saas/common-tasks/* /cloudflare-for-platforms/cloudflare-for-saas/ 301
@@ -2166,9 +2167,6 @@
21662167
/workers-ai/demos/* /workers-ai/guides/demos-architectures/:splat 301
21672168
/workers-ai/tutorials/* /workers-ai/guides/tutorials/:splat 301
21682169

2169-
# Workflows
2170-
/workflows/tutorials/ /workflows/examples 301
2171-
21722170
# Others
21732171
/logs/analytics-integrations/* /fundamentals/data-products/analytics-integrations/:splat 301
21742172
/fundamentals/notifications/* /notifications/:splat 301

worker/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ export default class extends WorkerEntrypoint<Env> {
2727
const res = await this.env.ASSETS.fetch(htmlUrl, request);
2828

2929
if (res.status === 404) {
30+
const redirect = await redirectsEvaluator(
31+
new Request(htmlUrl, request),
32+
this.env.ASSETS,
33+
);
34+
35+
if (redirect) {
36+
const location = redirect.headers.get("location");
37+
38+
return new Response(null, {
39+
status: redirect.status,
40+
headers: {
41+
Location: location + "index.md",
42+
},
43+
});
44+
}
45+
3046
return res;
3147
}
3248

worker/index.worker.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ describe("Cloudflare Docs", () => {
6565
expect(response.status).toBe(301);
6666
expect(response.headers.get("Location")).toBe("/workers/index.md");
6767
});
68+
69+
it("redirects /fundamentals/setup/manage-domains/remove-domain/index.md to /fundamentals/manage-domains/remove-domain/index.md", async () => {
70+
const request = new Request(
71+
"http://fakehost/fundamentals/setup/manage-domains/remove-domain/index.md",
72+
);
73+
const response = await SELF.fetch(request, { redirect: "manual" });
74+
75+
expect(response.status).toBe(301);
76+
expect(response.headers.get("Location")).toBe(
77+
"/fundamentals/manage-domains/remove-domain/index.md",
78+
);
79+
});
6880
});
6981

7082
describe("json endpoints", () => {

wrangler.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#:schema ./node_modules/wrangler/config-schema.json
22
name = "cloudflare-docs"
33
account_id = "b54f07a6c269ecca2fa60f1ae4920c99"
4-
compatibility_date = "2024-10-14"
4+
compatibility_date = "2025-06-02"
55
compatibility_flags = ["nodejs_compat"]
66
main = "./worker/index.ts"
77

0 commit comments

Comments
 (0)