3
votes

We have an OWIN application (built with Nancy and WebAPI).

When hosting it in a console application (with Katana selfhost), I don't have any compression enabled on static content.

I've tried to look for a working example of OWIN GZip middleware.

So far found a few like: Owin.Compression nuget, SqueezeMe nuget, https://gist.github.com/PinpointTownes/538cde1ed5e5d768355d and https://gist.github.com/PinpointTownes/ac7059733afcf91ec319

nothing seems to work - in the end the browser gets all responses without the Content-Encoding header and not compressed.

Tried adding compression in the end of Nancy's pipeline - doesn't work either.

While hosting in IIS - the IIS takes care of the compression.

Am I missing something? Is there something that overwrites the response body stream and removes the headers? Or, maybe, the host itself should take care of the compression?

From additional reading, this could be related to the Katana host. But the issue also happens in Nowin host.

Thanks.

1
Did you had any progress with that? I'm facing the same issueitsho
Both those links should work if they are put into the owin pipeline before Nancy, if they are added after the result is returned by nancy and have executed.Phill
@Phill I think I've already double checked that. I'll triple check it - especially the point where the original stream is being replaced by a wrapper - this should indeed happen before Nancy is called.Aryéh Radlé
Triple checked my findings - the middleware is registered before Nancy, thus Nancy writes into a Buffer that wraps a GZipStream. The headers are added correctly - and still, both in the browser and fiddler I see nothing but Transfer-Encoding: chunked.Aryéh Radlé

1 Answers

2
votes

Bottom line: The issue was not related to anything mentioned above. It appears that ESET AV monitors all HTTP traffic in the company. In case of a compressed response ESET decompresses it before it gets to any client (even in fiddler the request appears as not compressed).

See more here: https://community.virginmedia.com/t5/Email-Cloud-and-webspace/Is-Virgin-disabling-GZIP-compression-on-websites/td-p/2851488/page/2