Supporting glob pattern exclusion in route rules #2413
trc-mathieu
started this conversation in
General
Replies: 1 comment 7 replies
-
Hi. Instead of single routeRules:{
'api/auth/**': { proxy: false },
'api/**': { proxy: 'https://some-proxied-url/**' }
} Supporting regex and exclude patterns, while possible and a nice idea for this usecase, will add to generic compatibility and complexity of route rules (that needs to be integratable with cross deployment compatibility) so it is unlikely we add this syntax support. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I have a use case where an api exists at
/api/auth/
and some other endpoints starting with exactly/api/...
.I would like to define an exclusion pattern to be able to proxy requests that are not
/api/auth
to somewhere else. I haven't found a way and maybe it's not even possible. I was wondering if you had any suggestions or thoughts on this.Here's the part where you deal with routeRules:
https://github.com/unjs/nitro/blob/aabdc9c5c78c011a212c754058160ed23391361d/src/runtime/route-rules.ts#L46-L62
Without exclusion support, I need to explicitly set all the routes as proxy.
Ideally, I would like something like this to be supported:
Right now, I need to do specify every route, which is really cumbersome
Thank you for any help on this!
Beta Was this translation helpful? Give feedback.
All reactions