Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to cache response headers along with the response body in Memcached for use with Nginx?

share|improve this question

migrated from Aug 28 '12 at 13:20

This question came from our site for professional and enthusiast programmers.

up vote 1 down vote accepted

If you want cache responses in memcached you have to store your information in it manually by using something like a script. Nginx is not web accelerator like squid or varnish if you need that functionality out of the box take a look at varnish. It is working perfectly with nginx also.

share|improve this answer
Yes, I know it. I'm using Django as a backend and write the response to Memcached from there. But how can I cache response headers too? Because by default Nginx adds only it's own headers to response body read from Memcached. – Dingo Aug 27 '12 at 7:20
It seems I got you but what exactly http headers are you talking about ? – hostmaster Aug 27 '12 at 7:26
For a sample, I wish to control client caching, i.e. use such headers as "Expires", "Cache-Control", proper "Last-Modified" is also appreciated. Of course, with different values for different pages. – Dingo Aug 27 '12 at 12:24
I'm afraid you should use instead OR use another memcached plugin – hostmaster Aug 27 '12 at 12:53
I mean vanila ngx_http_memcached_module do not allow to store HTTP headers with data. For example, pages served by Nginx via Memcached storage have the default Nginx Content-Type. – hostmaster Aug 27 '12 at 13:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.