To allow this host, add "xxx.ngrok-free.app" to `server.allowedHosts` in vite.config.js.
To allow this host, add "xxx.ngrok-free.app" to
server.allowedHosts
in vite.config.js.2 Replies
Hi @Marlon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It looks like you're encountering an issue with Nuxt when trying to access your application through an ngrok tunnel. This is related to recent security changes in Vite (which Nuxt uses under the hood) that require explicitly allowing hosts other than localhost.
To fix this issue, you need to add your ngrok domain to the allowed hosts in your Nuxt configuration. Since Nuxt manages Vite configuration, you should add this to your
nuxt.config.ts
file rather than creating a separate vite.config.js
file:
This issue appeared after a recent Vite update (to version 6.1.0) which was integrated into Nuxt. The change was implemented as a security measure to prevent unauthorized access to your development server Github Issue #30783.
If you're also experiencing issues with HMR (Hot Module Replacement) or getting 403/404 errors, you might need additional configuration:
Remember that this configuration is only needed for development mode, not for production builds.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1032874064731185152> Kapa.ai is still learning and improving, please let me know how I did by reacting below.