Welcome! Log In Create A New Profile

Advanced

Re: Getting built in 404 instead of my custom one

October 09, 2012 03:58AM
On Mon, Oct 08, 2012 at 11:51:21PM -0400, Ian M. Evans wrote:
> On Mon, October 8, 2012 10:55 pm, Ian M. Evans wrote:
> [snip]
>
> > hmm, disabled the fastcgi cache and it served my error file okay. enabled
> > the cache and it served the nginx internal 404.
> >
> > Here's our cache setup:
> >
> > fastcgi_cache_path /var/lib/nginx/fastcgicache levels=1:2
> > keys_zone=MYCACHE:5m inactive=2h max_size=1g loader_files=1000
> > loader_threshold=2000;
> > map $http_cookie $no_cache { default 0; ~SESS 1; }
> > fastcgi_cache_key "$scheme$request_method$host$request_uri";
> > add_header X-My-Cache $upstream_cache_status;
> >
> > map $uri $no_cache_dirs {
> > default 0;
> > ~^/(?:phpMyAdmin|rather|poll|webmail|skewed|blogs|galleries|pixcache)
> > 1;
> > }
> >
> > Should I toss the custom 404 into a non-cached subdir?
> >
>
> that didn't work.
>
> It's definitely the fastcgi cache interfering with the php-parsed custom
> error page.
>
> I'm scratching my head here.
>
> My fastcgi.conf contains this additional cache info:
>
> fastcgi_cache MYCACHE;
> fastcgi_keep_conn on;
> fastcgi_cache_bypass $no_cache $no_cache_dirs;
> fastcgi_no_cache $no_cache $no_cache_dirs;
> fastcgi_cache_valid 200 301 5m;
> fastcgi_cache_valid 302 5m;
> fastcgi_cache_valid 404 1m;
> fastcgi_cache_use_stale error timeout invalid_header updating http_500;
> fastcgi_ignore_headers Cache-Control Expires;
> expires epoch;
> fastcgi_cache_lock on;
>
> I thought adding:
>
> map $uri $no_cache { default 0;
> /dhe404.shtml 1;
> }
>
> in my nginx.conf would do the trick, but nope. How can I stop the
> fastcgi_cache from handling the custom error page?

The issue is in fastcgi_cache_key:
fastcgi_cache_key "$scheme$request_method$host$request_uri";

It always uses client original $request_uri. Try:
fastcgi_cache_key "$scheme$request_method$host$uri?$args";


--
Igor Sysoev
http://nginx.com/support.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Getting built in 404 instead of my custom one

Ian M. Evans October 08, 2012 09:50PM

Re: Getting built in 404 instead of my custom one

Ian M. Evans October 08, 2012 10:18PM

Re: Getting built in 404 instead of my custom one

Ian M. Evans October 08, 2012 10:58PM

Re: Getting built in 404 instead of my custom one

Ian M. Evans October 08, 2012 11:52PM

Re: Getting built in 404 instead of my custom one

Igor Sysoev October 09, 2012 03:58AM

Re: Getting built in 404 instead of my custom one

Ian M. Evans October 09, 2012 04:28AM

Re: Getting built in 404 instead of my custom one

Ian M. Evans October 09, 2012 04:36AM

Re: Getting built in 404 instead of my custom one

Igor Sysoev October 09, 2012 04:48AM

Re: Getting built in 404 instead of my custom one

Ian M. Evans October 09, 2012 04:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 120
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready