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

UpstreamPathTemplate.Priority can be zero only when UpstreamPathTemplate is "/url" #270

Closed
rider11-dev opened this issue Mar 13, 2018 · 4 comments
Assignees
Labels
feature A new feature small effort Likely less than a day of development effort.

Comments

@rider11-dev
Copy link

rider11-dev commented Mar 13, 2018

Expected Behavior / New Feature

Make the Priority of UpstreamPathTemplate with value like "/goods/{url}" be zero too

Actual Behavior / Motivation for New Feautre

First,thanks for your great job!Ocelot is realy amazing!
Here is our case:
We have several microservice,each one has its unique service key,like orders、goods.
So we set UpstreamPathTemplate in general ReRoutes like below:
"UpstreamPathTemplate": "/orders/{url}"
"UpstreamPathTemplate": "/goods/{url}"
Now,we want to set a special ReRoute for a special action,so the UpstreamPathTemplate is like below:
"UpstreamPathTemplate": "/goods/delete"
However,when we call "/goods/delete",it always matches "/goods/{url}"
I have checked the code in Ocelot.Configuration.Creator.UpstreamTemplatePatternCreator.cs(

return new UpstreamPathTemplate(RegExForwardSlashAndOnePlaceHolder, 0);
),
and found that the UpstreamPathTemplate supports Piority setting,and I saw the purpose is to set "/{url}" to low level when matching(in method ForwardSlashAndOnePlaceHolder).
But,it only supports "/{url}".

So,is this for special consideration? Or could you make the Priority of UpstreamPathTemplate with value like "/goods/{url}" be zero too?

Tanks for your time!
Good luck!

Remarks:We are using the 5.0.0 release.

@TomPallister
Copy link
Member

@zpf1989 Thanks for your interest in the project. I think the only way to do this would be exposing the priority so you can configure it yourself. I think this is probably OK. I will have a look at it ASAP!

If you cannot wait then I suggest setting up specific ReRoutes for all of your endpoints rather than the /xxx/{catchAll} style!

TomPallister pushed a commit that referenced this issue Mar 13, 2018
@rider11-dev
Copy link
Author

OK,setting up specific ReRoutes for all endpoints may increase the difficulty of maintenance,since our endpoints will be a lot,and they probably are dynamic configured in our case.
In another way,most config of endpoints in a service are the same ,
So I'd prefer the Priority exposed.
Thanks for your time!

@TomPallister TomPallister reopened this Mar 13, 2018
@TomPallister TomPallister reopened this Mar 13, 2018
@TomPallister TomPallister added feature A new feature small effort Likely less than a day of development effort. labels Mar 13, 2018
@TomPallister TomPallister self-assigned this Mar 13, 2018
@TomPallister
Copy link
Member

@zpf1989 I've just released version 5.0.1 to NuGet...when this becomes available please give it a try. You can now set the Priority. Please see updated docs http://ocelot.readthedocs.io/en/latest/features/routing.html#priority

Let me know if this doesnt work!

@rider11-dev
Copy link
Author

Yes,it works!
I have tried a moment ago.
Thanks again!Tnaks for your passion and fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature small effort Likely less than a day of development effort.
Projects
None yet
Development

No branches or pull requests

2 participants