Custom response codes and content-types for memcache module
is at rambler-co.ru
Tue Jul 22 15:16:54 MSD 2008
On Tue, Jul 22, 2008 at 02:18:50PM +0400, Maxim Dounin wrote:
> On Tue, Jul 22, 2008 at 11:50:51AM +0200, M. Van der klip wrote:
> >I have recently written a patch which allows storage of custom HTTP
> >response codes and Content-type headers within memcache alongside the
> >actual response body. This allows us to pass the not_found's of the
> >memcache module to a PHP script which can serve and store different
> >kinds of responses in the cache.
> >The chosen approach is quite rough for this first version. The memcache
> >module is able to interpret two special commands prepended to the
> >response body.
> >This example serves a custom 404 page from memcached:
> >^SET-STATUS:404 Not Found|<HTML><BODY>...
> I don't think it's good idea to introduce brand-new format just
> for this. Why not use plain http headers as proxy module does (or
> http headers with CGI/1.1 directives as fastcgi does)? This
> particular reply can be simplified to:
> [cut here]
> Status: 404 Not Found
> [cut here]
I planned to add usual headers in memcached and mark them using flag.
HTTP/1.0 200 OK
Content-Type: application/xml; charset=UTF8
The flag probaly may be omitted, then nginx will look for "HTTP/" line
in response and treat the response as HTTP/0.9 (simple body) if
it has no "HTTP/".
> >This example serves /sitemap.xml from memcached:
> >^SET-CONTENT-TYPE:application/xml; charset=UTF8|<?xml version="1.0"
> >encoding="UTF-8" ?><urlset...
> >Please let me know if there is any interest in this patch. If so, I
> >could make it available. Without any warranties ofcourse. :P
> >Posted via http://www.ruby-forum.com/.
More information about the nginx