Closed joseehilton147 closed 3 months ago
Hi. Dev-proxy is supported by node-http-proxy so if there is a bug or usage issue, it should originate from there.
I would appreciate if you could provide a reproduction (stackblitz or codesandbox) in order to help 🙏🏼
Hey! No reproduction was provided for a month. I'll close this issue here. If it issue persists, feel free to raise a new issue with a reproduction and link this issue ☺️
Also, a proper proxy (e.g. route rules) is preferred by now.
Environment
node v18.14.0 nuxt 3.3.1
Reproduction
create a nuxt 3 project with follow structure:
/ /web/ /web/create
nuxt config:
nitro: { devProxy: { '/api': { target: process.env.NUXT_PUBLIC_API_MANAGER_BASE, changeOrigin: true, pathRewrite: {'^/api': ''}, }, }, }
when requests are made from /web/ and / works and on /web/create dont work
on request url from /web/create stays like this: http://localhost:3000/web/manager/
but on /web/ and / stays like: http://localhost:3000/manager/
Describe the bug
I cant made a single request on files on folders who isnt the index, the word "web" for example, dont get remove.
talking with chatGPT he gave me the code:
nitro: { devProxy: { '/manager': { target: process.env.NUXT_PUBLIC_API_MANAGER_BASE, changeOrigin: true, pathRewrite: {'^/manager': ''}, }, '/web/manager': { target: process.env.NUXT_PUBLIC_API_MANAGER_BASE, changeOrigin: true, pathRewrite: {'^/web/manager': '/manager'}, }, }, },
and this works.
There's a way to improve it or make it simple, like, the devProxy scan all folders and get all files and apply the same rule for all?
Additional context
No response
Logs
No response