
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
vite-plugin-allowed-hosts
Advanced tools
Specify a list of hosts that are allowed to access your Vite dev server.
By rejecting requests with an unrecognized Host header, this plugin prevents DNS rebinding attacks, which are possible even under many seemingly-safe web server configurations.
In a DNS rebinding attack, an attacker can create a malicious website that makes requests to the development server using the victim’s browser, potentially gaining access to sensitive data or executing unauthorized actions.
// vite.config.js
import pluginAllowedHosts from "vite-plugin-allowed-hosts";
export default {
plugins: [
pluginAllowedHosts({
hosts: ["acme.com", ".dev.acme.com"]
})
]
}
hostsType: 'auto' | 'all' | string | string[]
Default: 'auto'
When set to 'auto', it will always allow localhost and [server.host](https://vitejs.dev/config/server-options.html#server-host).
When set to 'all', no header check will be done. This is obviously not recommended.
A value beginning with a period . can be used as a subdomain wildcard. For example, '.acme.com' will match acme.com, www.acme.com, and any other subdomain of acme.com.
If the Host header doesn't match any value in this list, a 403 Forbidden HTTP error will be returned.
vite-plugin-allowed-hosts is released under the MIT License. See the bundled LICENSE file for details.
FAQs
List hosts allowed to access Vite dev server
We found that vite-plugin-allowed-hosts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.