WebFaction
Community site: login faq

I did a speed test on pingdom.com and it said that I should "Vary: Accept-Encoding header". How can I enable this on Apache2 (django).

asked 22 Jan '17, 05:09

robbyzob
4112
accept rate: 100%

Apart from iliasr's answer you should note that: 1. If your site runs under HTTPS you shouldn't use gzip (more on it here: breach attack) and 2. You should use the GZip middleware inside your Django project (if you are under HTTP).

(22 Jan '17, 18:50) nik

I've created a django app using the installer and linked it to a website. According to curl, that header exists:

HTTP/1.1 200 OK
Server: nginx
Date: Sun, 22 Jan 2017 13:52:51 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Frame-Options: SAMEORIGIN

A pingdom test also gave that an A grade.

This is a header the django framework adds.

That said, if you want apache to add it, you will need to update your app's httpd.conf file in the apache2/conf directory and add the following two lines:

LoadModule headers_module    modules/mod_headers.so
Header append Vary Accept-Encoding

The official document is here.

permanent link

answered 22 Jan '17, 14:29

iliasr ♦♦
2.1k14
accept rate: 35%

Somehow the gzip was activated (even without the django middleware) but the header encoding was missing. The two lines did help very much here. Thanks.

(22 Jan '17, 20:46) robbyzob

You can now selectively enable and disable gzip compression for HTTPS websites via our control panel at:

https://my.webfaction.com/websites

permanent link

answered 25 May '17, 16:15

seanf
12.2k31836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×905
×224
×14

question asked: 22 Jan '17, 05:09

question was seen: 2,082 times

last updated: 25 May '17, 16:15

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM