Skip to content
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

Incorrect Routing when a configuration exists with query param wildcard #2132

Closed
garv-daga opened this issue Aug 1, 2024 · 8 comments · Fixed by #2225
Closed

Incorrect Routing when a configuration exists with query param wildcard #2132

garv-daga opened this issue Aug 1, 2024 · 8 comments · Fixed by #2225
Labels
bug Identified as a potential bug merged Issue has been merged to dev and is waiting for the next release NET9 .NET 9 release Routing Ocelot feature: Routing
Milestone

Comments

@garv-daga
Copy link

garv-daga commented Aug 1, 2024

Ocelot now matches routes incorrectly.
This started breaking between versions 22.0.1 and 23.0.0.

If I have two configurations -

{
  "Routes": [
    {
      "DownstreamHostAndPorts": [
        {
          "Host": "{Endpoint1}"
        }
      ],
      "DownstreamPathTemplate": "/api/v1/abc?{everything}",
      "DownstreamScheme": "https",
      "UpstreamPathTemplate": "/api/v1/abc?{everything}"
    },
    {
      "DownstreamHostAndPorts": [
        {
          "Host": "{Endpoint2}"
        }
      ],
      "DownstreamPathTemplate": "/api/v1/{everything}",
      "DownstreamScheme": "https",
      "UpstreamPathTemplate": "/api/v1/abc2/{everything}"
    }
  ]
}

Now if I initiate a call with /api/v1/abc2/apple?isRequired=1

Expected Route: {Endpoint2}/api/v1/apple?isRequired=1

Actually Routes to: {Endpoint1}/api/v1/abc?isRequired=1"

Similar issue reported in: Originally posted by @Burgyn in #2065

@raman-m raman-m added bug Identified as a potential bug Routing Ocelot feature: Routing labels Aug 1, 2024
@raman-m
Copy link
Member

raman-m commented Aug 1, 2024

Duplicate of #2064 #2065

@raman-m raman-m marked this as a duplicate of #2064 Aug 1, 2024
@raman-m
Copy link
Member

raman-m commented Aug 1, 2024

Thanks for reporting this! Are you C# developer?

@garv-daga
Copy link
Author

Thanks for reporting this! Are you C# developer?

Thanks, Yes C# developer.

@raman-m
Copy link
Member

raman-m commented Aug 1, 2024

Could you look into the issue by debugging the solution and examining Ocelot's code when you have some spare time, please?
I am currently swamped with tasks for the v23.3 Hotfixes. I anticipate an open PR that will shed light on the issue, which I suspect might be related to a Regex problem.

@raman-m
Copy link
Member

raman-m commented Sep 21, 2024 via email

@pwshfan
Copy link

pwshfan commented Sep 21, 2024

@lelloz0 Hello Raffaele, Why did you delete your comment from issue #2132? Please be aware that using wildcards is not supported in Ocelot templates or placeholders. If you encounter any unusual behavior with special characters, please let us know.

I realized the issue is indeed somewhere else and not related to the wildcards. Thanks for the follow up!

@raman-m
Copy link
Member

raman-m commented Sep 21, 2024

@pwshfan, okay, we will concentrate on the originally reported bug. Feel free to report any issues, but please create new ones.

@raman-m raman-m added Winter'25 Winter 2025 release and removed Oct'24 October 2024 release labels Oct 26, 2024
@raman-m raman-m modified the milestones: October'24, Autumn'24 Oct 26, 2024
@raman-m
Copy link
Member

raman-m commented Nov 8, 2024

@int0x81, welcome to your assignment!

@raman-m raman-m added this to the .NET 9 milestone Dec 10, 2024
raman-m added a commit that referenced this issue Dec 10, 2024
…latePatternCreator` (#2225)

* fixed bug in UpstreamTemplatePatternCreator

* improved regex pattern + added unit tests

* fixed upstream template tests

* added acceptance test

* pr adaptions

* adopted regex related pr change requests

* Code review by @raman-m

---------

Co-authored-by: Raman Maksimchuk <[email protected]>
@github-project-automation github-project-automation bot moved this from In Progress to Done in Mentoring Finn Fiedler Dec 10, 2024
@raman-m raman-m added merged Issue has been merged to dev and is waiting for the next release and removed high High priority labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identified as a potential bug merged Issue has been merged to dev and is waiting for the next release NET9 .NET 9 release Routing Ocelot feature: Routing
Projects
Status: Done
3 participants