reverse-proxy icon indicating copy to clipboard operation
reverse-proxy copied to clipboard

Document Kestrel response header encoding

Open MihaZupan opened this issue 5 years ago • 3 comments

From #1055:

Document Kestrel response header encoding (dotnet/aspnetcore#33776) here.

MihaZupan avatar Nov 02 '21 17:11 MihaZupan

hi Chris @Tratcher / @MihaZupan / @karelz .. i'm trying to use yarp and facing this encoding issue due to a downstream system returning non-ASCII chars in the response header. since I don't have control over the downstream system, I am trying to see how we can be more tolerant at yarp's end.

now that aspnetcore/~kerner~ kestrel is updated (thanks Chris!) to optionally be more tolerant to non-ASCII characters, how can we tell yarp to leverage the tolerance. is there something similar to RequestHeaderEncoding coming up? (maybe something like ResponseHeaderEncoding or such!)

I was hoping this documentation update issue might help make that clear. even if someone can give a TL;DR on how to achieve this without this documentation-update-issue being resolved, it'd be great.

ChintanRaval avatar Sep 06 '23 05:09 ChintanRaval

You don't need to do anything YARP specific, you configure the Kestrel options directly in your proxy app.

Tratcher avatar Sep 06 '23 16:09 Tratcher

ah sorry. thanks @Tratcher. i'll try something via appSettings.. or even code like the below.

builder.WebHost.ConfigureKestrel(serverOptions =>
{
    serverOptions.ResponseHeaderEncodingSelector = _ => System.Text.Encoding.Unicode;
});

ChintanRaval avatar Sep 06 '23 22:09 ChintanRaval