App very slow on custom host
I have a project in which I use a custom host, instead of localhost:3000 I have a project.test:3000 except that my app is totally slow, calls to the api are very long
2 Replies
Hi @Kirito. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, it appears that your issue with slow performance when using a custom host is likely related to recent changes in Vite, which Nuxt uses for development.
The problem you're experiencing is described in this GitHub issue. Since Vite v5.4.12 and v6, there have been changes to prevent DNS rebinding attacks, which can affect Hot Module Replacement (HMR) and overall performance when using custom domains for development.
To resolve this issue, you can try the following solution:
1. Add the following configuration to your
nuxt.config.ts
file:
This configuration allows the Vite server to respond to requests from any host, which should resolve the performance issues you're experiencing with your custom domain.
If you're using the Nuxt CLI to start your development server, you can also try using the --host
flag to specify your custom domain:
This approach should automatically configure Vite to allow your custom host.
It's worth noting that while these solutions should improve performance, they do slightly reduce security during development. However, this is generally acceptable for local development environments.
If you continue to experience issues after applying these changes, you may want to check if there are any other factors affecting your app's performance, such as network conditions or the complexity of your API calls.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@339342482326421505> Kapa.ai is still learning and improving, please let me know how I did by reacting below.