Skip to content
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

Document Kestrel response header encoding #1346

Closed
MihaZupan opened this issue Nov 2, 2021 · 3 comments · Fixed by #2254
Closed

Document Kestrel response header encoding #1346

MihaZupan opened this issue Nov 2, 2021 · 3 comments · Fixed by #2254
Labels
Type: Documentation Improvements or additions to documentation
Milestone

Comments

@MihaZupan
Copy link
Member

From #1055:

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

@MihaZupan MihaZupan added Type: Idea This issue is a high-level idea for discussion. Type: Documentation Improvements or additions to documentation and removed Type: Idea This issue is a high-level idea for discussion. labels Nov 2, 2021
@karelz karelz added this to the Backlog milestone Nov 2, 2021
@ChintanRaval
Copy link
Contributor

ChintanRaval commented Sep 6, 2023

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.

@Tratcher
Copy link
Member

Tratcher commented Sep 6, 2023

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

@ChintanRaval
Copy link
Contributor

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;
});

MihaZupan added a commit that referenced this issue Sep 22, 2023
…arded Requests (#2254)

* add support for ResponseHeaderEncoding in HttpClientConfig (progress commit)

* fix ConfigValidatorTests

* fix ConfigurationConfigProviderTests by updating setup config to set ResponseHeaderEncoding appropriately

* fix bug in suggested interface (probably an old name for the instance?)

* update documentation (also closes issue Document Kestrel response header encoding #1346)

* ..and finally, validate if ForwarderHttpClientFactory leverages the HttpClientConfig.ResponseHeaderEncoding appropriately

* oopsie daisy

* simplify documentation by leveraging XML comments for code

* re-add removed section that educates consumers about ensuring to set server (with e.g. Kestrel) options for header encoding to match SocketsHttpHandler's header encoding options

* Apply suggestions from code review

* Replace links with code references

---------

Co-authored-by: Miha Zupan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants