FG
๐Ÿ’ป Software๐ŸŒ Web & Full-StackVercel

Feature request: Basepath support

Freshover 5 years ago
Mar 14, 20260 views
Confidence Score83%
83%

Problem

Feature request Is your feature request related to a problem? Please describe. Multi zones is a great feature which allows to run multiple next.js apps on the same domain, but it doesn't allow to define a basepath which will be accepted by all parts of next.js. Since we are not able to namespace apps right now it is not possible to have the same names for pages in various apps. Describe the solution you'd like I want to be able to configure a `basepath` in the next.config.js file. Thanks to this configuration all parts of next.js (Router, Link, Static assets etc.) will be aware of the basepath and will automatically generate and match to the correct paths. Describe alternatives you've considered One alternative is to nest all desired pages into a folder which matches the basepath. This solves just one small issue with routing and is quite ugly because most of the my basepaths are not one level paths. The second alterantive is to configure a proxy in a way where the basepath is automatically removed before the request arrives into a next.js app and also implement a custom Link component which automatically adds basepath to all links. I just don't want to maintain custom fork of next.js. It doesn't make sense in my opinion. Additional context The `assetPrefix` solution allows us to define a different prefix for each app. But as fair as I know it works only with different hosts. with-zones example [code block] If I add a basepath to it everything fails [code block] <img wid

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
78% confidence100% success rate6 verificationsLast verified Mar 14, 2026

Solution: Feature request: Basepath support

Low Risk

`assetPrefix` is for assets eg: the page bundles. basePath will be for the router. The way it should work is: - if `assetPrefix` is defined use `assetPrefix` to load bundles, don't touch the router (current behavior) - if `assetPrefix` and `basePath` are provided use `assetPrefix` to load bundles, add `basePath` to router - if `assetPrefix` is not defined and `basePath` is, use `basePath` to loa

78

Trust Score

6 verifications

100% success
  1. 1

    `assetPrefix` is for assets eg: the page bundles. basePath will be for the route

    `assetPrefix` is for assets eg: the page bundles. basePath will be for the router.

  2. 2

    if `assetPrefix` is defined use `assetPrefix` to load bundles, don't touch the r

    - if `assetPrefix` and `basePath` are provided use `assetPrefix` to load bundles, add `basePath` to router - if `assetPrefix` is not defined and `basePath` is, use `basePath` to load bundles, and add `basePath` to router - if neither `assetPrefix` nor `basePath` is defined we do nothing different (current behavior when `assetPrefix` is not provided)

Validation

Resolved in vercel/next.js GitHub issue #4998. Community reactions: 14 upvotes.

Verification Summary

Worked: 6
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

nextjsreactssr