-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Support the new "Forwarded" header (RFC 7239) #5978
Comments
Yes, we've seen it. Are you aware of any proxies that actually set that new header? |
No - but I haven't looked either. I recently built a small ASP.NET gateway proxy for Azure Service Fabric and that's why I stumbled upon this RFC. I guess this definitely isn't high priority since there won't be anyone who's setting just this header for a looong time. It would just be good to support it someday since it is a standard and will eventually get more common. |
I have a scenario whereby we have a reverse proxy (internally) passing requests to backend api’s and web apps; and one of the api's is ASP.NET 5 and using the BasicMiddleware classes to handle the headers from the upstream proxies. The team had implemented the newer RFC so BasicMiddleware can't handle |
We're using |
Would also like to have ability to extend the 'Forwared' header with a (somewhat) Related: https://github.com/aspnet/Hosting/issues/1120 |
@damianh do you expect PathBase to be different per request? That Hosting issue is about getting one value at startup. |
Yes, I would certainly like to be able to do so on a per-request basis. This will allow two scenarios where generated URLs and paths (fully qualified, rooted, relative) would "just work":
|
@Tratcher This is what I use near top of my
|
Arguably that point is somewhat circular, i.e. maybe if ASP.NET Core supported the 'Forwarded' header there would be more pressure on the reverse proxy implementations to support it. It is after all the only approach that actually has a formal specification (rfc7239). |
Just to mention that I've shipped a package that supports this https://github.com/ProxyKit/HttpOverrides |
Indeed. If no one starts implementing the standard, it will never gain traction. Also: Spring has support for this |
Perhaps someone could reach out to the YARP team to get their views, i.e. e.g. are they planning to implement rfc7239 |
@Tratcher, it is the documented way for Azure APIM : https://docs.microsoft.com/en-us/azure/api-management/policies/set-header-to-enable-backend-to-construct-urls |
YARP is being built by this team. We did add support for the new header in YARP but it's off by default. See https://microsoft.github.io/reverse-proxy/articles/transforms.html#forwarded Design note: this probably should be implemented in AspNetCore as a whole new middleware, it takes very different options. I'm also not sure what to do with the randomized client ids, stash them in a new request feature? |
@Tratcher I think there is value in keeping it in the same middleware, if possible, as the headers are conceptually the same. A class called What if Support for both
There are some options that only make sense for the
Would it be a plausible alternative to just provide a class for parsing the |
That's a good example of why these shouldn't be combine into one middleware. If a request has both headers then what order should they be processed in? It's ambiguous. |
Thanks for contacting us. We're moving this issue to the |
I'm not disagreeing with you @Tratcher, but I do think it's easy to argue that ChronologySince If adding Precision
What is a proxy supposed to do when there are an unequal amount of items added to There's also the question of whether new items should be appended or prepended to existing headers. There are numerous edge cases that are unresolved since these headers have been invented separately and never thoroughly specified in terms of a single, coherent standard. Since Because of all of these benefits, I think it's obvious that |
There is now a standard for the most common X-Forwarded-* headers. It was introduced with RFC 7239: "Forwarded HTTP Extension".
Example:
Forwarded: for=192.0.2.60;proto=http;by=203.0.113.43
It would be great if this could be supported.
The text was updated successfully, but these errors were encountered: