💾 Archived View for chirale.org › 2013-07-15_1205.gmi captured on 2024-05-12 at 15:23:25. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

How to enable gzip on proxy servers on Apache

I’m starting to use the gunicorn django app using supervisord. Here my configuration:

gunicorn django app

supervisord

Only the port 80 is exposed to other clients than localhost. The Varnish default backend is Apache (localhost:8080). I have a Drupal installation and a django installation on the same machine: since I want to expose django on the same domain at a defined location, I add to Apache this location:

ProxyRequests Off
ProxyPreserveHost On
Order deny,allow
Allow from all
\# on port 4180 gunicorn is running
\# @see /etc/supervisor.conf
ProxyPass /foo http://localhost:4180/
ProxyPassReverse /foo http://localhost:4180/
Order allow,deny
Allow from all
AddOutputFilterByType DEFLATE text/html
=> http://localhost:4180/
=> http://localhost:4180/

You can omit AddOutputFilterByType DEFLATE text/html: here I just take the response from gunicorn, compress and then serve to the client in this way:

(client) -\> varnish -\> apache -\> gunicorn

Here an example of what I get:

Image

=> https://chirale.wordpress.com/wp-content/uploads/2013/07/chrommi.png?w=586 Image

It’s a big page, but using gzip from 2 MB of the uncompressed page I get 417 KB gzipped text/html, less than 1/4 of the original!

Read also on the same topic: How to enable gzip on proxy servers on nginx

How to enable gzip on proxy servers on nginx

https://web.archive.org/web/20130715000000*/https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/gunicorn/

https://web.archive.org/web/20130715000000*/http://supervisord.org/

https://web.archive.org/web/20130715000000*/https://www.varnish-cache.org/

https://web.archive.org/web/20130715000000*/http://localhost:4180/

/> ProxyPassReverse /foo <a href=

https://web.archive.org/web/20130715000000*/http://localhost:4180/

/> Order allow,deny<br /> Allow from all<br /> <strong>AddOutputFilterByType DEFLATE text/html</strong></p></blockquote> <p>You can omit <strong>AddOutputFilterByType DEFLATE text/html</strong>: here I just take the response from gunicorn, compress and then serve to the client in this way:</p> <p><em>(client) -&gt; varnish -&gt; apache -&gt; gunicorn</em></p> <p><em>(client)<br /> <em>                (X-Varnish-Cache: MISS) </em></em></p> <p>Here an example of what I get:<br /> <a href=