Welcome! Log In Create A New Profile

Advanced

Re: HTTP 404 on memcache misses

Maxim Dounin
November 19, 2009 11:12AM
Hello!

On Thu, Nov 19, 2009 at 01:48:25PM +0100, Vicente Aguilar wrote:

> 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;

- error_page 404 @fallback;
+ 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.

http://wiki.nginx.org/NginxHttpCoreModule#error_page

Maxim Dounin
Subject Author Posted

HTTP 404 on memcache misses

Vicente Aguilar November 19, 2009 07:52AM

Re: HTTP 404 on memcache misses

Maxim Dounin November 19, 2009 11:12AM

Re: HTTP 404 on memcache misses

Vicente Aguilar November 20, 2009 02:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 258
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready