-
Notifications
You must be signed in to change notification settings - Fork 12k
devServer proxy strips Access-Control-Allow-* headers #23857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This seems to be related to a change in webpack-dev-server. Context: webpack/webpack-dev-server#4551 Are you able to test if by updating |
Based on the reproduction in #23859 it does seem like it's a matter of registration order. |
Hi @alan-agius4, I can confirm that changing the contents of |
For what it is worth, something else related to proxying that used to work up to v14.1 was defining a |
This seems to be a separate issue. I suggest you file an issue with a minimal reproduction with webpack-dev-server. |
Closed via #23869 |
Thanks for the quick resolution, @alan-agius4. Already managed to validate the fix by using the And regarding the mentioned onProxyRes callback not working, that seems to be working again as well (wanted to wait with creating a new issue until after this was resolved, to not create redundant issues). |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Command
serve
Is this a regression?
The previous version in which this bug was not present was
14.1
Description
Since version 14.2, proxied OPTIONS requests are missing Access-Control-Allow-* headers from the origin (and seem to add/replace
Access-Control-Allow-Origin
).Before, up to version 14.1, having a proxy configured like so:
Worked fine when the browser was making an CORS preflight OPTIONS request.
Here's 3 requests, first directly to the origin, second using local dev-server with Angular CL v14.1 and third using v14.2.
Request to origin:
Same request, but proxied by dev-server in v14.1:
Same request, but proxied by dev-server in v14.2:
Also, only noticing now after writing this, I see that the response status code is also changed/overriden.
Minimal Reproduction
ng new ng-cli-cors-headers
, cd into its directory.proxy.conf.json
with above contents (although using a different target that also responds to OPTIONS requests with specific Access-Control-Allow-* response headers)ng serve --proxy-config proxy.conf.json
Exception or Error
No response
Your Environment
Anything else relevant?
We also have
http-proxy-middleware
as a direct dependency installed, so also listing that here:The text was updated successfully, but these errors were encountered: