Unverified Commit 5221bd5d authored by Tomas Jansson's avatar Tomas Jansson Committed by GitHub

Update multi-zones.mdx (#78812)

To serve the static content from the right application you also need a
rewrite rule for the static assets and not only the actual content.

Fixes: #78811
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 87f90ac1
......@@ -73,7 +73,7 @@ const nextConfig = {
With the Multi Zones set-up, you need to route the paths to the correct zone since they are served by different applications. You can use any HTTP proxy to do this, but one of the Next.js applications can also be used to route requests for the entire domain.
To route to the correct zone using a Next.js application, you can use [`rewrites`](/docs/app/api-reference/config/next-config-js/rewrites). For each path served by a different zone, you would add a rewrite rule to send that path to the domain of the other zone. For example:
To route to the correct zone using a Next.js application, you can use [`rewrites`](/docs/app/api-reference/config/next-config-js/rewrites). For each path served by a different zone, you would add a rewrite rule to send that path to the domain of the other zone, and you also need to rewrite the requests for the static assets. For example:
```js filename="next.config.js"
async rewrites() {
......@@ -85,6 +85,10 @@ async rewrites() {
{
source: '/blog/:path+',
destination: `${process.env.BLOG_DOMAIN}/blog/:path+`,
},
{
source: '/blog-static/:path+',
destination: `${process.env.BLOG_DOMAIN}/blog-static/:path+`,
}
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment