Repository navigation
fix(@angular/build): keep proxy entry order and support a string context - #34258
Merged
alan-agius4 merged 2 commits intoOct 6, 2026
Merged
Conversation
…onfigurations http-proxy-middleware, which the Webpack-based development server uses, accepts a single path as `context`. The conversion of the array form skipped those entries, so they were dropped and nothing was proxied, without any message.
…iguration Glob keys were converted to regular expressions by adding the new key and deleting the old one, which moved every glob entry to the end of the object. Since Vite proxies a request with the first entry that matches it, a glob written before a broader plain key could never be used.
1 task done
There was a problem hiding this comment.
Code Review
This pull request updates the dev-server proxy configuration loading to support a single string context in the Webpack array form of the configuration file. It also ensures that converted glob entries maintain their original order, which is critical for Vite's proxying behavior. Corresponding unit tests have been added to verify these behaviors. Feedback on the changes points out a potential runtime TypeError if normalizedProxy is null or undefined when calling Object.entries(), and suggests adding a defensive check.
1 task done
1 task done
Collaborator
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
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #34257
normalizeProxyConfigurationloses two things when it turns the proxy file into the object Vite expects:^keys. With{"/api/auth/**": ..., "/api/": ...},/api/auth/logingoes to the/api/target.contextis a single string (context: '/api') is skipped, so nothing is proxied for it. The Webpack-based dev server accepts it.What is the new behavior?
contextis handled like a one-element array.Each fix is in its own commit with a test in
proxy-config_spec.ts. I checked that both tests fail without the fixes: the order test getsOTHER_API_RETURN, and the stringcontexttest getsindex.html.The third point of #34257 (globs and query strings) isn't part of this PR. For a trailing
/**, picomatch puts a$inside the generated regex, so it takes more than appending an optional query string, and it changes which requests get proxied.Does this PR introduce a breaking change?
Other information
A config that relied on globs being tried last, such as a catch-all
/**written before more specific plain keys, will now match in the order it's written. That's also how the Webpack-based dev server handles it.