Aspnetcore: Figure out pass-through compression for nginx

Created on 8 Oct 2016  路  9Comments  路  Source: dotnet/aspnetcore

When a request is proxied behind nginx the Accept-Encoding header is removed. This prevents the back-end from being able to compress the response.

Nginx supports compression on the front end, and compression between the back end and the front end, but it does not seem to allow the back-end compression to pass-through. See the integration tests in the ServerTests repo.

ResponseCompressionMiddleware affected-few area-middleware severity-nice-to-have task

Most helpful comment

You'll have to take that up with nginx.

All 9 comments

@Tratcher I'm doing the 2.0 topic updates now. There's no movement on this issue, correct? The current text states ...

Middlware issue when behind an Nginx reverse-proxy

When a request is proxied by Nginx, the Accept-Encoding header is removed. This prevents the middleware from compressing the response. For more information, see [NGINX: Compression and Decompression](https://www.nginx.com/resources/admin-guide/compression-and-decompression/). This issue is tracked by [Figure out pass-through compression for nginx (BasicMiddleware #123)](https://github.com/aspnet/BasicMiddleware/issues/123).

Leave it as it is?

@guardrex correct, no progress.

Is there any workaround for the issue?

You'll have to take that up with nginx.

Any updates so far?

@Tratcher sorry to ping you about this, i was looking at the docs here :
https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-3.1#working-with-iis-dynamic-compression

That pointed to this issue. As we nginx in k8s for the ingress part, i supposed we will be impacted by this as well ?

i'm not sure how to understand this :

You'll have to take that up with nginx.

Does it means AspNetCore cannot do this for you and you need to configure your own NGINX to be sure it properly forward the headers .... ?
If so, should this issue be closed ?

As it's both open and backlog, i do wonder if something is gonna be changed to aspnetcore to make it changed, and what ?
(also i would ask about the potential release where it would land ^^)

We have not found a way to make this work properly with nginx. If someone figures it out then we'll make any necessary changes to the middleware.

Just a drive by comment - I don't know jack about dot.net...
At least for nginx>=1.14 adding

proxy_http_version 1.1;
gzip on;

to the frontend nginx enables the pass-through compression.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

farhadibehnam picture farhadibehnam  路  3Comments

Kevenvz picture Kevenvz  路  3Comments

ipinak picture ipinak  路  3Comments

rbanks54 picture rbanks54  路  3Comments

fayezmm picture fayezmm  路  3Comments