N
Nuxtβ€’3d ago
plcdnl

Custom route roules

Is possible to do something like this to intercept all the xml routes? With this code seems not work 😦 routeRules: { "**.xml": { proxy: { to: https://admin.url/**, }, }, },
2 Replies
kapa.ai
kapa.aiβ€’3d ago
Hi @plcdnl. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, it is possible to intercept XML routes using routeRules in Nuxt, but the syntax in your example needs a slight adjustment. Here's the correct way to define a route rule for XML files:
routeRules: {
'/**/*.xml': {
proxy: '<https://admin.url/**'>
}
}
routeRules: {
'/**/*.xml': {
proxy: '<https://admin.url/**'>
}
}
This configuration will match any route ending with .xml and proxy it to the specified URL. Here are a few key points to note: 1. The pattern '/**/*.xml' will match any XML file in any directory. 2. The proxy value should be a string, not an object with a to property. This configuration can be added to your nuxt.config.ts file as described in the Nuxt documentation (https://nuxt.com/docs/api/nuxt-config#routerules-1). Remember that routeRules is a powerful feature that allows you to define various behaviors for different routes, including proxying, caching, and redirects as explained in the Nitro documentation (https://nitro.unjs.io/config#routerules). If you're still having issues after making these adjustments, you might want to check if there are any conflicting rules or if your Nuxt version supports this feature fully. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.aiβ€’3d ago
<@651174257098752000> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Want results from more Discord servers?
Add your server