Skip to content

Is it possible to disable escaping of query strings when forwarding request? #2264

Answered by MihaZupan
marekott asked this question in Q&A
Discussion options

You must be logged in to vote

Uri will escape such characters that it deems not safe to use in requests.

If in this case you know that this specific character is something you would want to let through, you can manually create the Uri and tell it not to make any more changes. Something along the lines of

services.AddReverseProxy()
    .AddTransforms(transforms =>
    {
        if (transforms.Route.RouteId == "myLegacyAppRoute")
        {
            transforms.AddRequestTransform(context =>
            {
                var query = context.Query.QueryString;

                if (query.HasValue && query.Value.Contains('\\'))
                {
                    var uri = RequestUtilities.MakeDestinationAddress(context.D…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by karelz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants