Skip to content

Consider adding more headers to HeaderNames #31374

Open
@benaadams

Description

@benaadams

Follow up to #31311 (comment)

List of HTTP header fields

With #31311 there are advantages to having items in the header list (single instance string).

This is most useful for request headers as they are always constructed strings; whereas response headers set in code are usually and interned string.

Non-exhaustive list of headers not currently included but are interesting:

Commonly used request headers:

public static readonly string XCorrelationId = "X-Correlation-ID";
public static readonly string XRequestId = "X-Request-ID";
public static readonly string XForwardedFor = "X-Forwarded-For";
public static readonly string XForwardedHost = "X-Forwarded-Host";
public static readonly string XForwardedProto = "X-Forwarded-Proto";

However if the server is also reverse-proxying/forwarding/routing between other servers; then response headers also become constructed strings (as they are parsed from the network). So that would then potentially include:

// Security header
public static readonly string ReferrerPolicy = "Referrer-Policy";
// Allow the browser to read cross origin timing values for the Resource Timing API
public static readonly string TimingAllowOrigin = "Timing-Allow-Origin";
// Ye olde "ASP.NET" header
public static readonly string XPoweredBy = "X-Powered-By";

Location is used for redirect; but sometimes Refresh is also used as a non-JS delay timed redirect (with interstitial)

public static readonly string Refresh = "Refresh";

Never seen; but rfc7240

public static readonly string Prefer = "Prefer";
public static readonly string PreferenceApplied = "Preference-Applied";

Metadata

Metadata

Assignees

No one assigned

    Labels

    Perfarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions