Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnableToFindDownstreamRouteError when the UpstreamPathTemplate contains $ #859

Closed
kvskranthikumar opened this issue Apr 16, 2019 · 3 comments

Comments

@kvskranthikumar
Copy link

kvskranthikumar commented Apr 16, 2019

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 "/Users/$metadata"

I observed that if the UpstreamPathTemplate has a dollar ($) then we get an error -

Ocelot.Responder.Middleware.ResponderMiddleware:Warning: requestId: 800000b2-0003-f500-b63f-84710c7967bb, previousRequestId: no previous request id, message: Error Code: UnableToFindDownstreamRouteError Message: Failed to match ReRoute configuration for upstream path: /Users/$metadata, verb: GET. errors found in ResponderMiddleware. Setting error response for request path:/Users/$metadata, request method: GET

@fvidesf
Copy link

fvidesf commented Aug 18, 2019

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

@MJeorrett
Copy link

+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

@MJeorrett
Copy link

To answer my own question, you can use the escape sequence '[$]' e.g. '/odata/[$]metadata' in the UpstreamPathTemplate.

@ThreeMammals ThreeMammals locked and limited conversation to collaborators Jan 19, 2024
@raman-m raman-m converted this issue into discussion #1930 Jan 19, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants