How to define route templates containing $
in URL paths?
#1930
-
I have this configuration in ReRoutes - {
"DownstreamPathTemplate": "/Users/api/v1/odata/$metadata",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 7004
}
],
"UpstreamPathTemplate": "/Users/metadata",
"UpstreamHttpMethod": [ "Get", "Post", "Delete" ]
} Which works perfectly, but I have a requirement where the UpstreamPathTemplate is I observed that if the UpstreamPathTemplate has a dollar
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
how did you manage to solve this? I had the same problem. You would declare the UpstreamPathTemplate like "/\$metadata", like you where escaping the $ character. The reason for this is I think is because internally Ocelota uses regex and $ gets interpreted different |
Beta Was this translation helpful? Give feedback.
-
+1 I am also working with Ocelot and OData and trying to create an aggregated /$metadata endpoint in ocelot. There are a few problems to solve and I have just come across this one. Would love to know if there is a work around? Thanks Matthew |
Beta Was this translation helpful? Give feedback.
-
To answer my own question, you can use the escape sequence '[$]' e.g. '/odata/[$]metadata' in the UpstreamPathTemplate. |
Beta Was this translation helpful? Give feedback.
Yes, it can be a solution.
But, better to define one route with correct templates via Placeholders feature like 👇