Skip to content

HTTP Trailers Causing Response Truncation in FireFox when Served from IIS on Windows Server 2022 #44944

Open

Description

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When serving a ASP.NET 6 MVC application using HTTP Trailers from IIS on Windows Server 2022 and accessing the application using FireFox on Windows (version 106.0.5), the responses are getting truncated.

Running in Visual Studio, served with Kestrel, and accessed via FireFox shows the trailers ("Server-Timing").

Expected Behavior

The response content should not get truncated, and the Server-Timing information should be available in the browser dev tools.

Steps To Reproduce

See https://github.com/eajhnsn1/net6-trailers-problem

OR

  1. Create a new ASP.NET 6 MVC application
  2. Add the following middleware function to the pipeline:
 app.Use(async (context, next) =>
            {
                if (AllowsTrailers(context.Request) && context.Response.SupportsTrailers())
                {
                    // Declare that there will be a trailer after the response body.
                    context.Response.DeclareTrailer("Server-Timing");

                    // Continue
                    await next(context);

                    // Output trailer
                    context.Response.AppendTrailer(
                        "Server-Timing",
                        "total;dur=123.4");
                }
                else
                {
                    await next(context);
                }             
                static bool AllowsTrailers(HttpRequest request)
                {
                    return request.Headers.ContainsKey("TE") &&
                        request.Headers["TE"].Contains("trailers");
                }
            });
  1. Serve the application from IIS on Windows Server 2022 (with HTTP/2 support), access it with Firefox

The page will load without correct styling, because the response content is truncated. The out-of-the-box sample application (for me) ends up missing a single character in the response (the last > on the html closing tag). In a real application, only the first portion of the response is actually downloaded. Confirm with View Page Source. If you add HTML content to the views in the sample page, more content gets truncated.

Exceptions (if any)

No response

.NET Version

6.0.402

Anything else?

See https://github.com/eajhnsn1/net6-trailers-problem/blob/main/Program.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    ExternalThis is an issue in a component not contained in this repository. It is open for tracking purposes.area-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