Skip to content

Wrong Http Headers on responses #60338

Open
Open
@vitasystems

Description

@vitasystems

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hello,

Just to summarize there is more than one issue(ASPNET CORE in NET 9):

1 Duplicate Accept-Range which is not a multiple value header therefore should appear only once in a response according to this RFC https://datatracker.ietf.org/doc/html/rfc7233#section-2.3

2 Vary header is set to Content-Encoding which might be good for proxies but browsers expect Vary: Accept-Encoding.
Furthermore the Content-Encoding is the header that must be set by the party that applied the encoding in this case clearly the server https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.2.2.

This contradicts the use of the Vary header which is a list of client headers that affected the decision making of the server.
https://datatracker.ietf.org/doc/html/rfc9110#field.vary

The RFC clearly states that it should contain "what parts of a request message"....

This clearly means that the correct header in the Vary response from the server is Accept-Encoding and NOT Content-Encoding.
This is because the client did NOT send Content-Ecoding...it sends Accept-Encoding. So using the Vary with a server response headers is not correct.

There was similar issue filed in June 2024 however this was for the Preview version of NET 9 and the issue does not include the Vary headers.

Here is a screenshot of the problems:

Image

Expected Behavior

The right http headers are sent in the response:

1- Only one Accept-Ranges header per response

2- Only request headers as the value of the Vary header as stated in the mentioned RFCs: Vary: Accept-Encoding (or other client set headers in comma separated list. Not server reponse headers like "Content-Encoding")

Steps To Reproduce

1 Create a project using the latest MVC template.

2 Make sure it uses app.MapStaticAssets();

3 Run the project and inspect the Browser developer tools

Exceptions (if any)

No response

.NET Version

9.0.102

Anything else?

Visual Studio 2022 17.12.4
Workload version: 9.0.100-manifests.693890c1

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions