WebFaction
Community site: login faq

Hi,

I have a url being handled by a Django view which uses the @never_cache decorator. As far as I can work out, this is being ignored by Webfaction's Apache server (which strangely seems to be routed through an nginx instance, given the header).

Is there anyway I can specify a certain url (presumably in Apache's config) that will inform the browser to never cache, or even better-yet to use the response header's attributes generated by Django?

This is all on the Django 1.3, Py2.7 and mod_wsgi 3.3 combo.

Cheers, Mark.

asked 15 Aug '11, 00:55

mfinger
112
accept rate: 0%

Your Django application is routed through Nginx; a reverse-proxy is necessary for everyone's applications to be served from the same port 80 on your webserver. The WebFaction Apache server shouldn't be entering the equation at all, though. This diagram describes the request and response flow, which goes Nginx -> your mod_wsgi Apache instance -> your Django instance.

We also don't explicitly modify any outgoing headers with the front-end Nginx server; it merely exists as a reverse proxy (via the proxy_pass directive) and to serve static media. If you use the command like curl -sI -H "Host: www.mydomain.com" 127.0.0.1:12345/path/to/exposed/method, do the headers show up? (in this example, "12345" is the port on which your mod_wsgi's Apache is listening.)

If the headers do show up there, do they then disappear when the same curl command is run, except for using the normal external URL www.mydomain.com/path/to/exposed/method?

(15 Aug '11, 01:13) ryans ♦♦

Internal URL

HTTP/1.1 302 FOUND
Date: Mon, 15 Aug 2011 06:34:05 GMT
Server: Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.1
Expires: Mon, 15 Aug 2011 06:34:05 GMT
Vary: Cookie
Last-Modified: Mon, 15 Aug 2011 06:34:05 GMT
Location: ***
Cache-Control: max-age=0
Connection: close
Content-Type: text/html; charset=utf-8

External URL

HTTP/1.1 302 FOUND
Server: nginx
Date: Mon, 15 Aug 2011 06:33:54 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Cookie
Location: ***

(15 Aug '11, 01:35) mfinger

Okay, we did our own test using the Cache-Control header and did not experience any problem getting it to pass through Nginx. Can you open a support ticket and include the exact commands you ran so that we can reproduce this? Thanks!

(15 Aug '11, 02:42) ryans ♦♦
Be the first one to answer this question!
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:

×910
×28
×4
×1

question asked: 15 Aug '11, 00:55

question was seen: 6,865 times

last updated: 15 Aug '11, 02:42

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2020 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