feat(core): add support for array of global prefixes#16102
Open
malkovitc wants to merge 1 commit intonestjs:masterfrom
Open
feat(core): add support for array of global prefixes#16102malkovitc wants to merge 1 commit intonestjs:masterfrom
malkovitc wants to merge 1 commit intonestjs:masterfrom
Conversation
7 tasks
Pull Request Test Coverage Report for Build 052bf0c4-da67-43b3-ba46-c7a94794509bDetails
💛 - Coveralls |
Member
|
This will break packages like |
Author
|
@kamilmysliwiec Thanks for the review! I analyzed the Current behavior with this PR:
Swagger analysis:Swagger uses
This is a functional limitation, not a breaking change - swagger will continue to work, but won't automatically know about additional prefixes. Proposed path forward:
Would this approach work? Or would you prefer a different solution? |
Hardanish-Singh
approved these changes
Jan 1, 2026
|
@kamilmysliwiec Is there a chance to release it? |
|
|
||
| private get prefixPath(): string { | ||
| return this.prefixPaths[0]; | ||
| } |
Member
There was a problem hiding this comment.
nit: could we move this above the constructor declaration?
Member
|
could you rebase to v12.0.0 branch? |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Type
What is the current behavior?
Issue Number: #16095
setGlobalPrefix()only accepts a single string prefix. Users who need to expose the same API under multiple base paths (e.g., for different deployment environments) previously used regex-style prefixes like(prefixOne|prefixTwo), which are no longer supported by path-to-regexp v8 in NestJS v11.What is the new behavior?
setGlobalPrefix()now accepts either a string or an array of strings:This provides a migration path for users who previously relied on regex-style prefixes.
Changes:
INestApplication.setGlobalPrefix()interface to acceptstring | string[]getGlobalPrefixes()method toApplicationConfigto retrieve all prefixesRoutePathFactoryto generate paths for each prefix in the arrayRouteInfoPathExtractorto generate middleware paths for all prefixesDoes this PR introduce a breaking change?
The change is backward compatible - existing code using a single string prefix will continue to work.