ASP.NET vNext, enable compression for IIS 8 on Azure?

how to enable gzip compression of responses using Content-Type / json application when asp.net 5 application is deployed in IIS 8 on Azure? Normally, this would be done using web.config, but now it's gone ... what's the new approach?

+2
asp.net-core
Jan 08 '15 at 8:54
source share
1 answer

You need a reverse proxy server application for the cache, then you can report a reverse proxy for compression.

In nginx, it looks like this:

server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; server_name localhost; gzip on; gzip_min_length 1000; #gzip_proxied expired no-cache no-store private auth; gzip_proxied any; gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_vary on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; location / { proxy_pass http://127.0.0.1:5004; } } 

So, here nginx will catch incoming requests on port 80, and then redirect them to the kestrel on the same computer, but to port 5004. Kestrel sends the response back to nginx. Since gzip is enabled, nginx compresses the response and sends it to the user. All you need to do is make sure that the application in Kestrel does not return HTTP headers such as HTTP 1.1 chuncked-encoding when outputting, for example, a file (for example, using what is used for Response.TransmitFile).

IIS 7.5+ supports reverse proxy.
See here for more details:
https://serverfault.com/questions/47537/can-iis-be-configure-to-forward-request-to-another-web-server

+1
Feb 27 '15 at 6:42
source share
— -



All Articles