-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
CORS on localhost #436
Comments
I have the same issue, Angular 13 drop support of --deploy-url and there is no way to redirect assets without CORS errors. |
@szymonworld if it helps, we are now providing the --deploy-url flag inside angular.json under architect->build->options
|
changes can be found here |
Thanks, I setted deployUrl into angular.json but, still my calls are blocked by CORS. Also, I was trying to use proxy, but the same story:
|
Hi @joeldenning , |
Hello, I'm having a similar issue but from what I gathered, the CORS fails because the pre-flight The issue seem to lie within |
After further investigation, I'm finally not sure that the issue comes from angular-builders, as I was able to reproduce the issue with @angular-devkit/build-angular:dev-server. I opened an issue on the angular-cli project: angular/angular-cli#23639 |
Apparently, the issue lies in webpack-dev-server: webpack/webpack-dev-server#4180 |
I encountered this today after upgrading all angular projects from 12 to 14. |
A fix has been merged in angular-cli (angular/angular-cli#23642), hopefully the next release of |
Finally got to try, updating |
@axeleroy |
paste your package json/angular json if you can. |
Hi @pgarzina My package.json would look like below
|
What would be the |
Well, I wonder if you shouldn't upgrade to Angular 14 (or at least angular-cli 14) in order to use the latest build-angular. The Angular team did not backport the fix to angular-cli 13. |
The fix is released in version 14.
|
Any fix we can have with Angular 13 for this? I have the same issue. http://localhost:4201/main.js is loading but not the json file. It gives the CORS issue. |
I don't think the fix has been (or will ever be) backported to Angular 13. There shouldn't be anything stopping you from upgrading to Angular 14, the API has been pretty stable between 13 and 14 and versions <15 are no longer supported . |
Describe the bug or question
Even though the bug does not originate from single-spa it does affect how the system works, so I am posting it here as well in hopes someone already experienced it and found a solution or can help.
After updating Angular 12 to Angular 13 we are no longer able to access our app served on localhost from outside of it, the request is being blocked by CORS.
this is what worked in Angular 12
ng s --project app-search --disable-host-check --port 4207 --deploy-url https://localhost:4207/ --ssl --public-host https://localhost:4207/
and stopped working in Angular 13.
When in development mode we are accessing our https://localhost:4207/ app from our public domain
We were looking into the docs around Webpack 4 and Webpack 5 and we can see that the disableHostCheck flag is removed from webpack 5 doc but is in webpack 4 docs. We tried playing around with disable host check and allowed hosts passing it to ng serve per official docs (https://angular.io/cli/serve) but with no luck.
Thank you
To Reproduce
We have tested this behavior on a clean Angular 13 project without including single-spa and we are aware that this is not a single-spa issue.
Expected behavior
Either disable host check or allow hosts should work.
Screenshots and/or console output
Additional context
We have opened to issue under angular/cli
angular/angular-cli#22992
and under Webpack
webpack/webpack#15752
we did try several ways to pass our domain to allowed hosts
"serve:single-spa:app-search": "cross-env NODE_ENV=development ng s --project app-search --allowed-hosts domain.com --port 4207 --ssl --public-host https://localhost:4207/"
As well as in the extra webpack config, although not sure if the flag is passed in the correct place in the config object
The text was updated successfully, but these errors were encountered: