routeRules doesn't work
phpmac opened this issue · comments
Environment
routeRules doesn't work
Reproduction
nitro: {
devProxy: {
'/sapi': {
target: 'https://xx',
// target: 'http://localhost',
changeOrigin: true,
prependPath: true,
},
'/bit/gooes': {
target: 'https://www.bitgoose.top/',
changeOrigin: true,
prependPath: true,
},
},
routeRules: {
'/sapi/**': { proxy: 'https://xx/**' },
'/bit/gooes/**': { proxy: 'https://www.bitgoose.top/**' },
},
},
Describe the bug
Doesn’t work after online build
Additional context
No response
Logs
No response
Would you see if you can reproduce this in pure Nitro (reproduction sandbox), and if so, raise there? 🙏
Also, how are you deploying your site, and to what provider?
Would you be able to provide a reproduction? 🙏
More info
Why do I need to provide a reproduction?
Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.
What will happen?
If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.
If needs reproduction
labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.
How can I create a reproduction?
We have a couple of templates for starting with a minimal reproduction:
👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox
A public GitHub repository is also perfect. 👌
Please ensure that the reproduction is as minimal as possible. See more details in our guide.
You might also find these other articles interesting and/or helpful:
Hold on
Already updated, never encountered the error, I was using nuxt2 before and it worked fine,
So proud of your team's enthusiasm to help!
Okay, so it's not reproducible any more?
nitro: {
devProxy: {
'/sapi': {
target: 'https://a-ztc-hardhat.11sph2.easypanel.host',
changeOrigin: true,
prependPath: true,
},
'/bit/gooes': {
target: 'https://www.bitgoose.top/',
changeOrigin: true,
prependPath: true,
},
},
routeRules: {
'/sapi/**': { proxy: 'https://a-ztc-hardhat.11sph2.easypanel.host/**' },
'/bit/gooes/**': { proxy: 'https://www.bitgoose.top/**' },
},
},
routeRules: {
'/sapi/**': { proxy: 'https://a-ztc-hardhat.11sph2.easypanel.host/**' },
'/bit/gooes/**': { proxy: 'https://www.bitgoose.top/**' },
},
/sapi will work under npm run dev
, but after npm run build
, npx serve .output/public
will prompt 404
npx serve .output/public
will just serve the static files.
To run a server, run node .output/server/index.mjs
.
Same, so can you try it? It's still a project engineering problem. I've invited you. The switching method is still the same, so I don't know if it's a bug in nuxt3.