Surprising X-Forwarded-Prefix transform behavior #2354
-
I have an asp.net core backend server with YARP in front. I am forwarding requests and stripping the path base when it forwards on. I am able to get it working but was confused on one bit.
new RouteConfig
{
ClusterId = GetCluster(proxy.Path),
RouteId = $"{proxy.Path}_route",
Match = new RouteMatch
{
Path = $"/{proxy.Path}/{{**catchall}}",
Hosts = new []
{
host
}
},
Transforms = new List<Dictionary<string, string>> { }
}
.WithTransformPathRemovePrefix($"/{proxy.Path}")
.WithTransformRequestHeader("X-Forwarded-Prefix", $"/{proxy.Path}")
.WithTransformXForwarded() // Why this is required? Why is the Is this correct behavior? I may be misunderstanding correct usage of this API. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's correct, if |
Beta Was this translation helpful? Give feedback.
That's correct, if
WithTransformXForwarded
isn't called, all theX-Forwarded-*
headers are stripped if present, and not added.