How do I run Next.js, Vite, or other JS dev servers on my VM?
Configure allowedDevOrigins (Next.js) or server.allowedHosts (Vite) so the dev server accepts requests from your exe.dev hostname.
The exe.dev [HTTPS proxy](../proxy) makes requests to `https://my-vm.exe.xyz/` work
to talk to your VM. To allow Vite and Next.js to work, you need to add your
VM hostname to the framework's origin allow-list.
## Next.js
Next.js ≥ 15.2 uses `allowedDevOrigins`:
```js
// next.config.js
module.exports = {
allowedDevOrigins: [
'my-vm.exe.xyz',
'my-vm.exe.xyz:8000', // and any other ports in 3000–9999 you use
],
};
```
```bash
npx next dev -H 0.0.0.0 -p 8000
```
See [allowedDevOrigins](https://nextjs.org/docs/app/api-reference/config/next-config-js/allowedDevOrigins).
## Vite
Vite ≥ 5.0 uses `server.allowedHosts`:
```js
// vite.config.js
import { defineConfig } from 'vite';
export default defineConfig({
server: {
host: '0.0.0.0',
port: 5173,
allowedHosts: ['my-vm.exe.xyz'],
},
});
```
See [server.allowedHosts](https://vitejs.dev/config/server-options.html#server-allowedhosts).