Skip to content

Commit

Permalink
docs: Add example config for Vite security update
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Jan 23, 2025
1 parent 8964c31 commit 2db8d47
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,25 @@ export default ({command}) => ({
},
},
server: {
// Allow cross-origin requests -- https://github.com/vitejs/vite/security/advisories/GHSA-vg6x-rcgg-rjx6
allowedHosts: true,
cors: true,
fs: {
strict: false
},
headers: {
"Access-Control-Allow-Private-Network": "true",
},
host: '0.0.0.0',
origin: 'http://localhost:3000',
port: 3000,
strictPort: true,
}
});
```

If you're using Chrome, are _not_ using `https` are _also_ using `localhost` for your Vite dev server, you may also need to disable the `chrome://flags/#block-insecure-private-network-requests` flag to allow HMR to work as expected.

#### Modern + Legacy Config

By default, Vite generates JavaScript bundles that work with modern browsers that
Expand Down

0 comments on commit 2db8d47

Please sign in to comment.