Independent Next.js Releases Behind One Domain

The organiser workspace needs a release. The public event listings don't. Putting both applications behind the same domain sounds like a reasonable way to let one move without dragging the other through another deployment.
That independence lasts until both applications claim the same JavaScript URL, or a link asks one router to navigate through the other application's component tree. The domain name hasn't told the browser where the team boundary is.
My example uses two Next.js 14 App Router applications: public listings at / and an organiser workspace beneath /workspace. A small reverse proxy chooses the application for each request. The workspace has two built releases so that I can switch between them whilst leaving the public application alone.
Give Every Request an Owner
I start with the paths, before separating repositories or choosing deployment jobs. /workspace and everything beneath /workspace/ belong to the workspace. The public application owns the remaining page routes.
The exact prefix matters. A loose check for a string beginning with /workspace would also capture /workspace-news, which might be a perfectly legitimate public page. Match the root path or the prefix followed by a slash.
I also give each release its own compiled‑asset prefix. Public release A uses /public-a-static; workspace releases A and B use /workspace-a-static and /workspace-b-static. Those paths keep pointing at the release which produced the files, even after the default workspace destination changes.
Ordinary files have their own rules too: /public-media/ goes to the public application, and the workspace's versioned image files live beneath /workspace-media/. This is a routing table with several kinds of request, rather than two page prefixes and a hopeful catch‑all.
A missing workspace page should return the workspace's 404. An unavailable workspace should return an unavailable response. Falling through to the public application makes the outage harder to diagnose and can return an entirely unrelated page with a reassuring 200 status.
An Asset Prefix Needs a Serving Route
For this Next 14 configuration, the workspace advertises its prefixed JavaScript and CSS URLs and rewrites those requests back to Next's asset handler:
module.exports = {
assetPrefix: '/workspace-a-static',
async rewrites() {
return {
beforeFiles: [
{
source: '/workspace-a-static/_next/:path+',
destination: '/_next/:path+',
},
],
};
},
};The proxy must send /workspace-a-static/_next/... to workspace release A first. The rewrite then runs inside that application. Configuring only one side leaves a correct‑looking URL with nobody able to serve it.
assetPrefix doesn't rewrite every URL in the markup. A handwritten <img src="/logo.svg"> still requests /logo.svg. If both applications assume that path belongs to them, whichever one wins the proxy rule supplies the picture. I use explicit public‑asset namespaces and inspect those requests alongside the compiled chunks.
The useful assertion is stronger than "the asset returned 200". I want the correct release and the expected bytes. Returning a different application's file successfully is still a failure.
Cross the Boundary with an Ordinary Link
Inside the workspace, next/link can retain the application shell and update the destination route. Returning to the public listings requires a new document:
import Link from 'next/link';
export function WorkspaceNavigation() {
return (
<nav aria-label="Workspace">
<Link href="/workspace/settings">Workspace settings</Link>
<a href="/">Public events</a>
</nav>
);
}The second link is internal to the website but external to this particular Next application. That distinction qualifies the normal advice in my article on next/link: sharing an origin does not give the applications a shared router.
My lab puts a small counter in each layout. Moving between routes inside one application preserves it. Crossing to the other application creates a fresh component instance. That is an observable consequence to consider before putting a half‑completed organiser form on one side and its next step on the other.
I check direct entry, refresh, Back, and Forward as well as clicking the visible navigation. Browser history can restore a previous document, so I don't turn one observed counter value after Back into a promise about every browser's restoration policy.
The two applications also load their own CSS. A header looking identical in a design file doesn't mean the second document inherits the first one's stylesheet. Shared packages can reduce duplication, but each application still chooses and ships a version.
Roll Back the Workspace, Including Its Files
I build public A, workspace A, and workspace B separately. The release manifest records build identifiers, action identifiers, compiled‑file hashes, and public‑file hashes. Building B must not change public A's recorded files.
Switching the active workspace destination then sends new workspace page requests to B. Public page requests continue to A, and requests for A's old workspace assets still have an explicit destination. Rolling back changes the workspace page destination again; it doesn't rebuild the public application to disguise a dependency.
I deliberately route one old workspace chunk to the public application as a negative control. The test must detect the missing or incorrect bytes, then recover when the asset rule is restored. Otherwise the reassuring set of green navigation checks may simply have avoided the broken route.
Retaining assets is only part of release compatibility. An already open tab can hold route data and Server Action references from its earlier release. Keeping its JavaScript available doesn't prove that a different server can execute those actions. Decide how old requests are identified and retained, or how users are asked to refresh, before treating an independent deployment as safe for every open tab.
Share Identity Deliberately
My fixture sets a host‑only session cookie with Path=/, making the same synthetic identity available to both applications. It also sets a workspace‑only cookie with Path=/workspace; requests to the public root must not include it. Neither cookie specifies Domain. Redirects also use the configured public origin; an internal server address would send the browser somewhere its host‑only cookie does not belong.
These checks demonstrate browser cookie scope, not authentication. The fixture accepts a fixed user so that no identity provider is needed. A real application still needs a trusted session and authorisation at each operation, as I explain in my NextAuth.js guide. Cookie paths don't make neighbouring applications a security boundary against one another.
Server Actions add another proxy detail. Next checks the request origin against the host information it receives. Preserve the intended public host, control forwarded host headers at the trusted proxy, and configure permitted origins narrowly where the deployment needs it. I test a real successful action, then replay its request with an unexpected origin and check that no second mutation is recorded. Merely seeing an error page wouldn't establish that the operation had been prevented.
Wrapping Up
I would use zones when the route boundary matches a useful release boundary and the team is prepared to own the proxy contract. If every ordinary task crosses between the applications, the repeated document loads and shared session decisions may cost more than the split saves.
My multi‑zone release lab contains both applications, the release switch, and the asset, navigation, cookie, outage, and rollback checks. The part I want to make boring is very specific: a workspace release should change the workspace, whilst the public application keeps serving the files it already had.
Postscript
November 2026: Next.js 15 removed the need for the extra serving‑zone asset rewrite shown above. My lab keeps the Next 14.2.12 configuration separate from its Next 16.4.6 companion and runs both with the same routing checks. The historical framework runs on Node 20.6.1; the browser harness and newly frozen dependency locks are current verification tools. Next's current multi‑zone guidance covers the revised configuration.