Skip to content

Conversation

alan-agius4
Copy link
Collaborator

Vite's allowedHosts option does not enable CORS; instead, it allows the dev server to respond to requests with a matching hostname (e.g., http://example.com/main.js). It only verifies that the request’s hostname is on the allowed list. However, this does not consider the origin in the case of a CORS request.

This commit updates Vite's configuration to enable CORS.

Closes #29549

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Feb 11, 2025
Vite's `allowedHosts` option does not enable CORS; instead, it allows the dev server to respond to requests with a matching hostname (e.g., http://example.com/main.js). It only verifies that the request’s hostname is on the allowed list. However, this does not consider the `origin` in the case of a CORS request.

This commit updates Vite's configuration to enable CORS.

Closes angular#29549
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 12, 2025
@alan-agius4 alan-agius4 removed the request for review from clydin February 12, 2025 09:43
@alan-agius4 alan-agius4 merged commit be15b88 into angular:main Feb 12, 2025
9 checks passed
@alan-agius4 alan-agius4 deleted the vite-cors branch February 12, 2025 09:43
@alan-agius4
Copy link
Collaborator Author

The changes were merged into the following branches: main, 19.1.x

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Access-Control-Allow-Origin header missing in dev server for assets

3 participants