From e7156de9fb2b96b18fb8e63566601e32ffe3625c Mon Sep 17 00:00:00 2001 From: Nick Babcock Date: Thu, 17 Oct 2024 07:06:39 -0500 Subject: [PATCH 1/2] Fix docs syntax for proxy routeRules The configuration option requires a "to", which is omitted in the docs. --- docs/guide/route-rules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/route-rules.md b/docs/guide/route-rules.md index 88366a01..b99ce7a5 100644 --- a/docs/guide/route-rules.md +++ b/docs/guide/route-rules.md @@ -13,9 +13,9 @@ export default createApp({ cors: true, headers: { "access-control-allow-methods": "GET" }, }, - "/old-page": { redirect: "/new-page" }, - "/proxy/example": { proxy: "https://example.com" }, - "/proxy/**": { proxy: "/api/**" }, + "/old-page": { redirect: { to: "/new-page" } }, + "/proxy/example": { proxy: { to: "https://example.com" } }, + "/proxy/**": { proxy: { to: "/api/**" } }, }, }, routers: [ From 5c857b3575b8bb1fbf5ea8f3688fa85912b25f7d Mon Sep 17 00:00:00 2001 From: Nikhil Saraf Date: Wed, 23 Oct 2024 00:12:44 +0530 Subject: [PATCH 2/2] Update route-rules.md --- docs/guide/route-rules.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/guide/route-rules.md b/docs/guide/route-rules.md index b99ce7a5..6d0d2d51 100644 --- a/docs/guide/route-rules.md +++ b/docs/guide/route-rules.md @@ -9,13 +9,17 @@ export default createApp({ server: { routeRules: { "/_build/assets/**": { headers: { "cache-control": "s-maxage=0" } }, - "/api/v1/**": { - cors: true, - headers: { "access-control-allow-methods": "GET" }, - }, - "/old-page": { redirect: { to: "/new-page" } }, - "/proxy/example": { proxy: { to: "https://example.com" } }, - "/proxy/**": { proxy: { to: "/api/**" } }, + '/blog/**': { swr: true }, + '/blog/**': { swr: 600 }, + '/blog/**': { static: true }, + '/blog/**': { cache: { /* cache options*/ } }, + '/assets/**': { headers: { 'cache-control': 's-maxage=0' } }, + '/api/v1/**': { cors: true, headers: { 'access-control-allow-methods': 'GET' } }, + '/old-page': { redirect: '/new-page' }, // uses status code 307 (Temporary Redirect) + '/old-page2': { redirect: { to:'/new-page2', statusCode: 301 } }, + '/old-page/**': { redirect: '/new-page/**' }, + '/proxy/example': { proxy: 'https://example.com' }, + '/proxy/**': { proxy: '/api/**' }, }, }, routers: [