Skip to content

Commit ab94aee

Browse files
committed
fixup dynamic redirects, fix worker logic, add test
1 parent e2c716e commit ab94aee

File tree

4 files changed

+93
-76
lines changed

4 files changed

+93
-76
lines changed

public/__redirects

Lines changed: 72 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -711,9 +711,6 @@
711711
/fundamentals/setup/account/customize-account/appearance/ /fundamentals/account/customize-account/ 301
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
714-
/fundamentals/setup/account/* /fundamentals/account/:splat 301
715-
/fundamentals/setup/manage-domains/* /fundamentals//manage-domains/:splat 301
716-
/fundamentals/setup/manage-members/* /fundamentals/manage-members/:splat 301
717714

718715
# gateway
719716
/gateway/about/ /cloudflare-one/policies/gateway/ 301
@@ -827,6 +824,74 @@
827824
/learning-paths/clientless-access/ /learning-paths/clientless-access/concepts/ 301
828825
/learning-paths/application-security/default-traffic-security/security-level/ /learning-paths/application-security/default-traffic-security/browser-integrity/ 301
829826

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

832897
# load-balancing
@@ -1716,9 +1781,8 @@
17161781
/workers-ai/markdown-conversion/ /workers-ai/features/markdown-conversion/ 301
17171782

17181783
# workflows
1719-
17201784
/workflows/reference/storage-options/ /workers/platform/storage-options/ 301
1721-
1785+
/workflows/tutorials/ /workflows/examples 301
17221786

17231787
# workers KV
17241788
/kv/platform/environments/ /kv/reference/environments/ 301
@@ -2013,6 +2077,9 @@
20132077
/firewall/recipes/* /waf/custom-rules/use-cases/:splat 301
20142078
/web3/polygon-gateway/* /web3/ 301
20152079
/vectorize/configuration/* /vectorize/best-practices/:splat 301
2080+
/fundamentals/setup/account/* /fundamentals/account/:splat 301
2081+
/fundamentals/setup/manage-domains/* /fundamentals/manage-domains/:splat 301
2082+
/fundamentals/setup/manage-members/* /fundamentals/manage-members/:splat 301
20162083

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

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

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

worker/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ export default class extends WorkerEntrypoint<Env> {
3333
);
3434

3535
if (redirect) {
36-
return Response.redirect(redirect.url + "index.md", redirect.status);
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+
});
3744
}
3845

3946
return res;

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)