-
Notifications
You must be signed in to change notification settings - Fork 14
Description
I am running a NUXT 3 project in my local environment on localhost:8099.
We use localias to proxy it to frontend.domain.local.
We use yarn (yarn dev --host).
Since the last dependencies update, I am facing a known error that came up with a Vite update on frontend.domain.local, with a 403 status:
Blocked request. This host ("frontend.domain.local") is not allowed.
To allow this host, add "frontend.domain.local" to `server.allowedHosts` in vite.config.js.
This error only happens on frontend.domain.local, it doesn't occur on localhost:8099.
I found suggestions for fixes here on SO.
Using NUXT, we do not have a vite.config.js file so I tried the following:
- add a
server: allowedHostsoption to our nuxt.config.ts file
export default defineNuxtConfig({
server: {
allowedHosts: ['frontend.domain.local'],
},
- add a new vite.config.ts file:
import { defineConfig } from "vite";
export default defineConfig({
server: {
host: 'frontend.domain.local',
allowedHosts: ['frontend.domain.local'],
});
I also tried with the host key on both files.
server: {
host: 'frontend.domain.local',
},
But I still get the 403 error "Blocked request. This host ("frontend.domain.local") is not allowed" on frontend.domain.local.
Unsure whether this issue relates to localias, or is exclusively a Vite/NUXT issue.
Could also relate to issue #48 Doesn't work with the vite dev server. But it seems that for the poster DeluxeOwl the fix in vite.config is working - while for us it isn't.