-
-
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] option server.allowedHosts doesn't take into account "true" #19242
Comments
This comment has been minimized.
This comment has been minimized.
Yes, same issue coming to me as well when I am trying below config in my vite config file (vite.config.ts). Please fix it.
|
https://vite.dev/config/server-options#server-allowedhosts Tried to follow the same procedure but not working.. Blocked request. This host ("hostname") is not allowed. |
I wasn't able to reproduce it with a simple setup. I need a reproduction to investigate this one. |
Hello @Reaster0. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Also encountering this after pushing an update today, no changes to vite config |
I resolved this by updating vite.config - what's odd here is that I had not upgraded to 6+ and the error just presented overnight. export default defineConfig({
plugins: [sveltekit()],
server: {
cors: {
origin: ['https://mysubdomain.domain.io', 'http://localhost:5173'],
methods: ['GET', 'POST'],
allowedHeaders: ['Content-Type']
},
allowedHosts: ['mysubdomain.domain.io'] //added this
}
}); |
The problem still exists in 6.0.11. Downgrading to 6.0.8 makes it work. |
Hm... please take a look into tools that use vite to run. For example I have same issue with vite + storybook, because of storybook. I defined in storybook config the server options: import {mergeConfig} from 'vite';
// ...
async viteFinal(config) {
return mergeConfig(config, {
server: {
hmr: {
path: '/ws'
}
}
});
}, and the problem is that mergeConfig will replace |
Mine is just a plain Vite project with React. Nothing else. |
i'm not sure i have the time rn to make a replication for something this simple, in the mean time i've rollbacked to 6.0.8 it's really a breaking issue for a lot of people, changing the default allowedHost from 0.0.0.0 to localhost and having a bug on the same field to set back to 0.0.0.0 will break a lot of vite installations, |
yes you can set the hosts you want in allowedHosts, the bug we encounter specifically is when setting allowedHosts to "true" |
I've tried it again but still cannot reproduce. I need a reproduction. |
Understood, I also tried I am now using 6.0.10 so can only speak to that version. |
Also happening for latest 4.x.x version. Downgrading to |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Caution Please note that downgrading will make you vulnerable to attacks described in GHSA-vg6x-rcgg-rjx6. |
Describe the bug
hi, i've recently updated vite to 6.0.9, the main change being the allowedHosts server conf field,
it's said in the documentation that if set to true, it will accept any hosts, but even when setting it to true i get the error:
Blocked request. This host ("hidden") is not allowed.
To allow this host, add "hidden" to
server.allowedHosts
in vite.config.js.(maybe i could be dumb but it really doesn't seem to work)
Reproduction
google.com
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: