-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Vite >6.0.9 has CORS issue with laravel-vite #19239
Comments
i have the same problem |
Same here |
Same for me. Downgrade to |
Hello @VOBradley. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Same problem here, happens on Vite |
Same problem here, but fixed (locally) by adding a
The issue comes after upgrading to [email protected] |
Facing the same kind of problem. |
same here on laravel projects downgraded to v6.0.8 fixed for me |
same issue for me, upgrade to 6.0.9 failed as described above, had to downgrade. In my case I am using laravel-vite-plugin (v1.1.1). |
changed to |
Downgrading your vite version to 6.0.8 is a temporality fix until they fix the bug. npm i [email protected] EDIT: Only do this if your project isnt live or just a personal local project |
Please share a minimal reproduction, it doesn't need to be from the OP. Downgrading to 6.0.8 represents a security risk, see GHSA-vg6x-rcgg-rjx6 |
Security risk whatever, if u aint using a live project. Downgrading will help the current issue. It helped with my project at least. |
Same in 4 separate different projects that got auto updated by Renovate to v6.0.9 today.
|
Found a dynamic temporary solution. |
this doesnt work with me even when putting a static value |
[spoke to soon] The @moehaidar26 solution does get the server to start, however, I cannot access the dev site, I get a CORS error If that is a requirement now this should have been listed as a breaking change to the config file, as (I think) most of us only run this in dev, and hence do not really deal with CORS etc. Had to revert back to .8 |
yes i had it in the wrong place it should be like this @moehaidar26 thanks |
I don't know if this counts as a minimal reproduction... as a Laravel developer this is the easiest way:
You can use the minimum setup, no starter kit, no migrations. You do have to have some kind of development setup for PHP with Composer, though (like Laravel Herd or Laravel Valet).
As long as there is no newer version of vite out this will install vite 6.0.9 and the error "error during build: TypeError: Invalid URL..:" is thrown. |
It is a patched security issue. The best solution for now is to use vite: 6.0.8 or vite: 5.4.11 or vite: 4.5.5. However do note that this is just a temporary solution until we get a fix from vite team. Reference: GHSA-vg6x-rcgg-rjx6 |
@hmawla please update your post, the vulnerability is not about using dev-mode in a production deployment, but public websites being able to access a dev-server running on your workstation, eg when you are developing with the devserver open in one browser-tab and researching for a solution for a bug in a second tab. |
Thank you, I have updated my comment. |
The culprit appears to be the default value for An issue has already been opened. |
this worked for me. thank |
the issue still exits in Vite 6.0.9 not sure if there is another version |
yes, #19241 was released in [email protected] |
also released in 4.5.8, 5.4.13 |
This do not fix issue on Laravel without making additional configuration.
The configuration below must be set in
|
In the laravel plugin thread a poster explained to add a server config. In import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import vue from '@vitejs/plugin-vue'
const domain = "example.test" // insert domain
export default defineConfig({
server: {
origin: 'https://' + domain + ':5173',
cors: true,
},
... This fixed mine ( should be clear, I am using valet and securing my local dev sites) |
Caution Please note that setting For the case of export default defineConfig({
server: {
cors: { origin: 'http://[::1]:5173' },
}
}) if |
I don't think any application can prevent the attack from happening unless that application modifies the browsers binaries, because it happens inside the browser. |
For the Laravel users in the thread who are having CORS issues, I've prepared a fix in the If you need special config, we recommend setting the |
Although temporarily fixed within Vite itself, we also have a PR up to ensure that we are using a well-formed URL for the |
I've renamed the issue to be about laravel-vite-plugin as it's the main repro we have for this issue. Any other CORS behavior changes is likely related to the security fix breaking change as noted in GHSA-vg6x-rcgg-rjx6. I think we can close this once there's a fix in laravel-vite-plugin. |
I have this problem too and that's my quick fix: upgraded Vite to 6.0.10
and in laravel .env |
We have released Thanks! |
Describe the bug
After updating VITE to version 6.0.9 I get the following error when vite build
FULL ERROR:
Reproduction
https://o.kg
Steps to reproduce
set 6.0.9 vite version
npm install
npm run build
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: