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

Check for Content-Length in response headers #15

Closed
billbogaiv opened this issue Sep 20, 2016 · 1 comment
Closed

Check for Content-Length in response headers #15

billbogaiv opened this issue Sep 20, 2016 · 1 comment

Comments

@billbogaiv
Copy link

@billbogaiv billbogaiv commented Sep 20, 2016

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.

@Taritsyn
Copy link
Owner

@Taritsyn Taritsyn commented Sep 27, 2016

Hello, Bill!

In WebMarkupMin 2.2.0 fixed this error.

Thanks for information! Instead of removing the Content-Length HTTP header, I change its value.

@Taritsyn Taritsyn closed this Sep 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants