ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.32k stars 1.63k forks source link

how to change servicename dynamically by form value #1785

Closed d0apga closed 10 months ago

d0apga commented 10 months ago

Expected Behavior / New Feature

I want to set servicename dynamically by querystring value or form post value. for example upstream url: /openapi form post: api=task.control&params={} or form post: api=task.new&params={} when api value=task.control,set servicename to "taskcontrolservice", when api value=task.new,set servicename to "createtaskservice", is there a convenient way to implement it now?

Actual Behavior / Motivation for New Feature

servicename only can set from route

Steps to Reproduce the Problem

1. 1. 1.

Specifications

ks1990cn commented 10 months ago

@d0apga Yes, you can do for your specific case. I don't think we have any thing as such for now.

But it looks like can be quite complicated if we gradually start considering alot of things to route dynamically.

Consider following scenario:

1.) For same upstream url /UpstreamURL, there can be downstream with different authentication - maybe any downstream uses JWT, maybe anyone uses only key value pair or maybe LDAP. 2.) There can be situation we have to consider if any route can be connected to web socket / SignalR 3.) There can be situation with different body/headers. 4.) Different Ratelimiting, QoS etc..

And for everything we have to revisit our Ocelot.Json and the way we configure.

@ggnaegi @raman-m What are your thoughts on this?

d0apga commented 10 months ago

@ks1990cn Yes, it does need to consider multiple impacts. Currently, I am trying to rewrite the Consul service discovery provider to achieve this goal.

raman-m commented 10 months ago

@d0apga commented on Nov 15

is there a convenient way to implement it now?

No

My dear friend from China, Why is your GitHub repo empty? It has only forked repos. Why?

raman-m commented 10 months ago

@d0apga commented on Nov 16 Currently, I am trying to rewrite the Consul service discovery provider to achieve this goal.

You can do any Ocelot researches, but inside of your forked Ocelot repo in your account! Where is the Ocelot? You are able to create good professional PRs to official Ocelot repo with good ideas. You must follow development process!

I'm not interested to discuss this issue...

raman-m commented 10 months ago

I want to set servicename dynamically by querystring value or form post value.

You must use Service Discovery tools! More here

Yes, it does need to consider multiple impacts. Currently, I am trying to rewrite the Consul service discovery provider to achieve this goal.

First, stop lying us! Second, fork Ocelot repo! And, good luck!