Hi
nginx + memcached in front of a tomcat farm, config looks like:
location ~* ^/bla/bla.*$ {
set $memcached_key $uri;
if ( $uri ~ .*/$ ) {
set $index index.html;
set $memcached_key $uri$index;
}
memcached_pass memcache;
default_type text/html;
error_page 404 @fallback;
}
location @fallback {
proxy_pass http://tomcats;
}
The first time the client accesses a page there’s a memcached miss and
the request is proxy_passed to the back-end tomcats, who generate the
page, save it to the cache and the HTML is returned to the client.
Everything OK but one detail: the HTTP 404 code from the memcached miss
reaches the client!
On subsequent accesses the client gets an HTTP 200 and the HTML served
from memcached, but on the first access nginx responds with an HTTP 404
AND the HTML code. Most browsers (tested with firefox, safari and lynx)
seem not to care about this 404 and render the page, but wget for
instance refuses to download the page the moment it receives the 404.
Tested on nginx 0.7.62 and .64.
Anybody else experiencing this behavior? Anything wrong with my config?
I guess this could lead to a series of problems, e.g. with Google if
you’re unfortunate enough to have an empty cache when it starts crawling
through your site.
Regards