Nuxt 3 Vite server proxy does not work after build
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.14.2
- Nuxt Version:
3.0.0-rc.3
- Package Manager:
yarn@1.22.18
- Builder:
vite
- User Config:
components
,buildModules
,typescript
,css
,plugins
,unocss
,runtimeConfig
,vueuse
,vite
,build
,nitro
- Runtime Modules:
-
- Build Modules:
@vueuse/nuxt@8.5.0
,@pinia/nuxt@0.1.9
,@unocss/nuxt@0.33.5
Reproduction
nuxt.config.ts
vite: { server: { proxy: { "/proxy_path": { target: "https://domain.com", changeOrigin: true }, } }
Describe the bug
After run build success I’m start command node .output/server/index.mjs
to preview build but it’s got an error (page not found).
Note: Development work fine.
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to configure proxy in Vite? - Stack Overflow
I was trying to follow the docs and created ...
Read more >Server-Side Rendering - Vite
Vite provides built-in support for server-side rendering (SSR). The Vite playground contains example SSR setups for Vue 3 and React, which can be...
Read more >Dev server proxy - Vue.js Developers
The solution is to proxy calls to the API server during development. Luckily, this is something that's easy to configure with the Webpack...
Read more >Setting up proxy for localhost API testing, not working with vite
Cant seem to get the proxy server setup so I can avoid CORS errors when trying to hit my little node.js/express server on...
Read more >Configuration - Nuxt
By default, the Nuxt development server host is localhost which is only accessible from within the host machine. In order to view your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Setting a vite proxy only works in development; this is even true when not using Nuxt: https://vitejs.dev/config/#server-proxy.
Follow https://github.com/unjs/nitro/issues/113 for built-in proxy support in Nitro. Until then you can implement manually using Nitro server middleware.
thank you, but it didn’t help either, I tried it before writing, only installing @nuxtjs-alt/proxy helped