-
Notifications
You must be signed in to change notification settings - Fork 843
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
Proxy should enable routing based on header values #405
Comments
@davidni, can you give some examples of the types of header routing you need to support? |
We at Azure Quantum are also blocked by the unavailability of this feature. We are expecting to use this feature to enable a dynamic fleet of short-lived service instances in a dev-test situation. We envisage passing in a header - say We want to be able to dynamically construct the clusters and routes to be able to allow the routing of a fixed URL to either We will presumably want to be able to deregister environments after they have been decommissioned, so we will likely want to use some form of database to look up registered environments; or, if there is a way to dynamically implement the routing rule itself, maybe dispense with any registration and directly route to a constructed URL. |
@johnazariah while that could be done with routing, it actually sounds a lot closer to A/B testing as described in #126. |
Interesting... So is there a way to attach affinity from a request to a specific route? And how can we specify targets without headers? |
Let's move the discussion over to 126. |
If this is for individual dev test scenarios, I don't think this A/B testing like #126. |
Triage: Needs design - match on full value with optional case sensitivity. |
I think we'll want to have this as well. Could we perhaps help out with this? |
@jmezach can you start by sharing your requirements and scenarios? We have a few implementations of this already, hopefully I just need to port them over and adapt them to YARP. |
Well, one scenario where I think this will be helpful is for our test environments. Currently we're trying to host multiple test environments on the same servers. Since we're not in containerland yet we need to do pre- and postfixes to keep things from interfering with each other. That basically means our test environments currently are very different from production, which leads to all kinds of problems. With YARP we feel this could be simplified if we have header based routing. We could let the client set a header indicating which environment they want to target and YARP would route traffic to that environment. But rather than having to do this for all our services, we could just do it for a single one. Obviously that single service would need to be deployed with a prefix or postfix, but it wouldn't require a whole separately configured client for example. Does that make sense? |
Understood. Can you also describe or give examples of the headers themselves? Certainly you need to be able to specify the header name and value, but what are the matching rules?
|
This would be useful for us as well. In our use case a simple case sensitive match for a single value would be enough, no wildcard needed. In our scnario we send a custom header: X-Environment: EnvironemntIdnetifier The header value is a string, probably around 30 characters. |
Our current environments are named TEST1 through TEST12 so I imagine they wouldn't have to be very long names and I would be fine with a case insensitive match. As for the more advanced scenario's I don't think we are going to need that any time soon and we would be happy with just a match on a single value as @mmosca mentioned. |
Another user case could be to prevent sending the requests to destination if certain headers are not present, like |
Hmm, content-type is a tricky example because it's a structured header, you'd at least need partial matching. E.g. |
It seems like a combination of dynamic routing and session affinity. However, I think you need to have only one cluster and then dynamically add/remove destinations as necessary. |
Design meeting notes: Support matching against a list of header constraints which implicitly AND together (a request has to match all constraints).
A header constraint has the following characteristics:
Keeping in mind that we eventually want to transition this into AspNetCore 6.0, we should also consider what header constraint MVC attribute would look like.
Perf: AspNet routing supports a lot of complex perf optimizations like INodeBuilderPolicy. For the first pass we don't plan to implement many of those. Once we have the basic feature set we can optimize as needed. |
Multiple partners have asked for header based routing. I'll ask them to give examples below. @davidni has an implementation in Island Gateway and had been working on this as an AspNetCore 5 feature but it wasn't done in time (dotnet/aspnetcore#23594). The plan is to port Island Gateway's work to YARP so it works on 3.1 and 5.0 and then contribute it back to AspNetCore in 6.0.
The text was updated successfully, but these errors were encountered: