Skip to content

Check for Content-Length in response headers #15

@billbogaiv

Description

@billbogaiv

Note: This may or may not be specific to ASP.NET Core.

Currently, if middleware upstream sets the Content-Length header (i.e. StaticFiles), then usage of WebMarkupMin results in a 200, but no content. This is because the resulting content-size is no longer the same as reported by the header-value. My current resolution is to insert my own middleware to remove the header:

app.UseWebMarkupMin();

app.Use(async (context, next) =>
{
    await next();

    if (context.Response.Headers.ContainsKey("Content-Length"))
    {
        context.Response.Headers.Remove("Content-Length");
    }
});

app.UseStaticFiles();

A bit more info. is posted here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions