How to Catch all even without the placeholder? #1872
-
I have the configuration as below, {
"Routes": [
{
"UpstreamHttpMethod": [],
"UpstreamPathTemplate": "/api/items/{everything}",
"DownstreamPathTemplate": "/api/items/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8102
}
]
}
],
"GlobalConfiguration": {
"BaseUrl": "http://localhost:8100"
}
} If the client sends a request to I went through Routing and Configuration documentation and general Google search, but could not find a solution. Can you please help? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi Lasindu! According to the Catch All docs to make route So, the Finally, I would say your routes should be: {
"Routes": [
{
"UpstreamPathTemplate": "/api/items/{everything}",
"DownstreamPathTemplate": "/api/items/{everything}",
// other props
},
{
"UpstreamPathTemplate": "/api/items/",
"DownstreamPathTemplate": "/api/items/",
// other props
}
],
"GlobalConfiguration": { }
} But... I recommend you a life hack to merge both routes to the one: {
"Routes": [
{
"UpstreamPathTemplate": "/api/{everything}",
"DownstreamPathTemplate": "/api/{everything}",
// other props
}
],
"GlobalConfiguration": { }
} So, now the |
Beta Was this translation helpful? Give feedback.
-
Current Catch All logic will remain as-is. Refactoring will introduce huge & significant breaking changes of the product current features! Current But... merging both routes to the one makes sense. I agree! Given: Catch All routes are
Is that something you're looking for? It should function as other gateways products to handle and process all URLs by Catch All approach. {
"Routes": [
{
"UpstreamPathTemplate": "/api/items/",
"DownstreamPathTemplate": "/api/items/",
"ExclusiveCatchAll": true // new required property
},
// Routes below are not required, so ignored
{
"UpstreamPathTemplate": "/api/items/{everything}",
"DownstreamPathTemplate": "/api/items/{everything}"
},
{
"UpstreamPathTemplate": "/api/items/?{everything}",
"DownstreamPathTemplate": "/api/items/?{everything}"
}
]
} Looks good? |
Beta Was this translation helpful? Give feedback.
You ask strange question...
🆗 Anyway, answering the question "How to Catch all even without the placeholder?"
Answer ⬇️
It is impossible to catch all paths/URLs without a placeholder in the form
{...}
.If you define single
/api/items/
route then you will be able to process single URL only!Hope you've got the answer you wanted.