Skip to content

Commit 6e6912d

Browse files
feat: proxy setup (#7499)
1 parent 9e96d2e commit 6e6912d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

apps/docs/next.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ const config = {
1111
experimental: {
1212
globalNotFound: true,
1313
},
14+
// docs.prisma.io: proxy all requests to prisma.io/docs/... (browser stays on docs.prisma.io).
15+
// Only enable when this deployment is the subdomain proxy; leave unset when this app is used as DOCS_ORIGIN (e.g. *.vercel.app) to avoid a loop.
16+
// For local testing: ENABLE_DOCS_SUBDOMAIN_PROXY=1 and DOCS_PROXY_TARGET=http://localhost:<WEBSITE_PORT>/docs (website must be running on that port)
17+
async rewrites() {
18+
if (process.env.ENABLE_DOCS_SUBDOMAIN_PROXY !== "1") {
19+
return [];
20+
}
21+
const base =
22+
process.env.DOCS_PROXY_TARGET ?? "https://prisma.io/docs";
23+
return [
24+
{
25+
source: "/:path*",
26+
destination: `${base.replace(/\/$/, "")}/:path*`,
27+
},
28+
];
29+
},
1430
};
1531

1632
export default withSentryConfig(withMDX(config), {

0 commit comments

Comments
 (0)