# Getting built in 404 instead of my custom one

**URL:** <https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544>\
**Category:** NGINX\
**Created:** [October 9, 2012, 3:50am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544 "2012-10-09T03:50:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 9, 2012, 3:50am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/1 "2012-10-09T03:50:08Z")

</div>

Just noticed that my custom 404 page isn’t getting served in all  
circumstances and I’m getting the bare internal 404 at times. Looking at  
the debug, it seems to be choosing my 404, but somehow not displaying  
it:

2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http finalize request:  
404,  
“/zeep.shtml?” a:1, c:1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http special response:  
404,  
“/zeep.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 internal redirect:  
“/dhe404.shtml?”

If it’s redirecting to the dhe404.shtml file, why isn’t it serving it?  
Could it be an issue with the fastcgi cache? (shtml files are actually  
php)

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 4:56am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/2 "2012-10-09T04:56:10Z")

</div>

On Mon, October 8, 2012 10:16 pm, Ian M. Evans wrote:

> On Mon, October 8, 2012 9:49 pm, Ian M. Evans wrote:
> 
> > Just noticed that my custom 404 page isn’t getting served in all  
> > circumstances and I’m getting the bare internal 404 at times. Looking at  
> > the debug, it seems to be choosing my 404, but somehow not displaying  
> > it:
> 
> here’s a longer bit of the debug:

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?

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 4:17am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/3 "2012-10-09T04:17:00Z")

</div>

On Mon, October 8, 2012 9:49 pm, Ian M. Evans wrote:

> Just noticed that my custom 404 page isn’t getting served in all  
> circumstances and I’m getting the bare internal 404 at times. Looking at  
> the debug, it seems to be choosing my 404, but somehow not displaying it:

here’s a longer bit of the debug:

2012/10/08 21:09:34 [debug] 13419#0: \*6056489 accept: 24.212.205.68 fd:5  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 event timer add: 5:  
60000:1125303069  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 epoll add event: fd:5 op:1  
ev:80000001  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post event 0920CD1C  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 delete posted event  
0920CD1C  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 malloc: 0922DA80:660  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 malloc: 09220E70:1024  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 posix\_memalign:  
091E7FE0:4096 @16  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http process request line  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv: fd:5 1024 of 1024  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http request line: “GET  
/zeep.shtml HTTP/1.1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http uri: “/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http args: “”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http exten: “shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http process request  
header  
line  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http header: “Host:  
[www.example.com](http://www.example.com)”  
2012/10/08 21:09:34 [debug] 13419#0: _6056489 http header: “User-Agent:  
Mozilla/5.0 (Windows NT 6.0; WOW64; rv:15.0) Gecko/20100101  
Firefox/15.0.1”  
2012/10/08 21:09:34 [debug] 13419#0: 6056489 http header: "Accept:  
text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8"  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http header:  
“Accept-Language: en-us,en;q=0.5”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http header:  
“Accept-Encoding: gzip, deflate”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http header: “DNT: 1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http header: “Connection:  
keep-alive”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http alloc large header  
buffer  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 posix\_memalign:  
091EE230:256  
@16  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 malloc: 09219C88:8192  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http large header alloc:  
09219C88 8192  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http large header copy:  
714  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv: fd:5 388 of 7478  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv: fd:5 -1 of 7090  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv() not ready (11:  
Resource temporarily unavailable)  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post event 0920CD1C  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 delete posted event  
0920CD1C  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http process request  
header  
line  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv: fd:5 356 of 7090  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http header done  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 event timer del: 5:  
1125303069  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 rewrite phase: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script complex value  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/usr/local/nginx/htdocs”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “0”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http map started  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http map: “/zeep.shtml”  
“0”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “0”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 add cleanup: 091E8B48  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http file cache exists: -5  
e:0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 cache file:  
“/var/lib/nginx/fastcgicache/e/43/f170708cf22b5b20fc1f7ca3cfcf943e”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http file cache lock u:1  
wt:0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream cache: -5  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 posix\_memalign:  
091C5650:4096 @16  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“GATEWAY\_INTERFACE”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“CGI/1.1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“GATEWAY\_INTERFACE: CGI/1.1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“SERVER\_SOFTWARE”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy: “nginx”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“SERVER\_SOFTWARE: nginx”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“QUERY\_STRING”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
"QUERY\_STRING: "  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“REQUEST\_METHOD”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “GET”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“REQUEST\_METHOD: GET”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“CONTENT\_TYPE”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
"CONTENT\_TYPE: "  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“CONTENT\_LENGTH”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“CONTENT\_LENGTH: "  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“SCRIPT\_FILENAME”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/usr/local/nginx/htdocs”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“SCRIPT\_FILENAME: /usr/local/nginx/htdocs/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“PATH\_TRANSLATED”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/usr/local/nginx/htdocs”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“PATH\_TRANSLATED: /usr/local/nginx/htdocs/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“REQUEST\_URI”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“REQUEST\_URI:  
/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“DOCUMENT\_URI”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“DOCUMENT\_URI: /zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“DOCUMENT\_ROOT”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/usr/local/nginx/htdocs”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“DOCUMENT\_ROOT: /usr/local/nginx/htdocs”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“SERVER\_PROTOCOL”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“HTTP/1.1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“SERVER\_PROTOCOL: HTTP/1.1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“REMOTE\_ADDR”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“24.212.205.68”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“REMOTE\_ADDR:  
24.212.205.68”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“REMOTE\_PORT”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “54558”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“REMOTE\_PORT:  
54558”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“SERVER\_ADDR”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“67.19.142.122”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“SERVER\_ADDR:  
67.19.142.122”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“SERVER\_PORT”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “80”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“SERVER\_PORT:  
80”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
“SERVER\_NAME”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“[www.example.com](http://www.example.com)”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“SERVER\_NAME:  
[www.example.com](http://www.example.com)”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param: “HTTP\_HOST:  
[www.example.com](http://www.example.com)”  
2012/10/08 21:09:34 [debug] 13419#0: _6056489 fastcgi param:  
“HTTP\_USER\_AGENT: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:15.0)  
Gecko/20100101 Firefox/15.0.1”  
2012/10/08 21:09:34 [debug] 13419#0: 6056489 fastcgi param:  
"HTTP\_ACCEPT:  
text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“HTTP\_ACCEPT\_LANGUAGE: en-us,en;q=0.5”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“HTTP\_ACCEPT\_ENCODING: gzip, deflate”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param: “HTTP\_DNT:  
1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 fastcgi param:  
“HTTP\_CONNECTION: keep-alive”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http cleanup add: 091E8C54  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 get rr peer, try: 1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 socket 10  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 epoll add connection:  
fd:10  
ev:80000005  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 connect to  
127.0.0.1:10004,  
fd:10 #6056490  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream connect: -2  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 posix\_memalign:  
091C0330:128  
@16  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 event timer add: 10:  
60000:1125303437  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http finalize request: -4,  
“/zeep.shtml?” a:1, c:2  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http request count:2 blk:0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post event 09264228  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post event 092641F4  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 delete posted event  
092641F4  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http run request:  
“/zeep.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream check  
client,  
write event:1, “/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream recv(): -1  
(11: Resource temporarily unavailable)  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 delete posted event  
09264228  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream request:  
“/zeep.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream send request  
handler  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream send request  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 chain writer buf fl:0  
s:2256  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 chain writer in: 091E8C70  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 writev: 2256  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 chain writer out: 00000000  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 event timer del: 10:  
1125303437  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 event timer add: 10:  
60000:1125303439  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post event 0920CD50  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post event 09264228  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 delete posted event  
09264228  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream request:  
“/zeep.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream dummy  
handler  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 delete posted event  
0920CD50  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream request:  
“/zeep.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream process  
header  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 malloc: 091C6658:4096  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv: fd:10 128 of 4029  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
01  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
06  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
00  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
01  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
00  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
64  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
04  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record byte:  
00  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi record  
length: 100  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi parser: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi header:  
“Status: 404 Not Found”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi parser: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi header:  
“X-Powered-By: PHP/5.3.6”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi parser: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi header:  
“Content-type: text/html”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi parser: 1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http fastcgi header done  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http file cache free, fd:  
-1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 finalize http upstream  
request: 404  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 finalize http fastcgi  
request  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free rr peer 1 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 close http upstream  
connection: 10  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 091C0330, unused: 88  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 event timer del: 10:  
1125303439  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 reusable connection: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http finalize request:  
404,  
“/zeep.shtml?” a:1, c:1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http special response:  
404,  
“/zeep.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 internal redirect:  
“/dhe404.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 rewrite phase: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script complex value  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/usr/local/nginx/htdocs”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script copy:  
"/maintenance.html4 [debug] 13419#0: \*6056489 generic phase: 4  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 generic phase: 5  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 access phase: 6  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 access phase: 7  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post access phase: 8  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 try files phase: 9  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http init upstream, client  
timer: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “http”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “GET”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“[www.example.com](http://www.example.com)”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var:  
“/zeep.shtml”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http cache key:  
“[httpGETwww.example.com/zeep.shtml](http://httpGETwww.example.com/zeep.shtml)”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “0”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http script var: “0”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 add cleanup: 091E8F50  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http file cache exists: 0  
e:0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http upstream cache: 404  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http finalize request:  
404,  
“/dhe404.shtml?” a:1, c:3  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http special response:  
404,  
“/dhe404.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http set discard body  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 charset: “” \> “ISO-8859-1”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 HTTP/1.1 404 Not Found  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 write new buf t:1 f:0  
0921CAE4, pos 0921CAE4, size: 174 file: 0, size: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http write filter: l:0 f:0  
s:174  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http output filter  
“/dhe404.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http copy filter:  
“/dhe404.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http postpone filter  
“/dhe404.shtml?” 091E8FD8  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 write old buf t:1 f:0  
0921CAE4, pos 0921CAE4, size: 174 file: 0, size: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 write new buf t:0 f:0  
00000000, pos 080CA180, size: 116 file: 0, size: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 write new buf t:0 f:0  
00000000, pos 080C9AE0, size: 52 file: 0, size: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http write filter: l:1 f:0  
s:342  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http write filter limit 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 writev: 342  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http write filter 00000000  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http copy filter: 0  
“/dhe404.shtml?”  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http finalize request: 0,  
“/dhe404.shtml?” a:1, c:3  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http request count:3 blk:0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http finalize request: -4,  
“/dhe404.shtml?” a:1, c:2  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http request count:2 blk:0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http finalize request: -4,  
“/dhe404.shtml?” a:1, c:1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 set http keepalive handler  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http close request  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http log handler  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 run cleanup: 091E8F50  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http file cache cleanup  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http file cache free, fd:  
-1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 run cleanup: 091E8B48  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 091C6658  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 091E7FE0, unused: 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 0921BC90, unused:  
104  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 091C5650, unused:  
1636  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 event timer add: 5:  
5000:1125248440  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 0922DA80  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 09220E70  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 hc free: 00000000 0  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 hc busy: 09237D08 1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 free: 09219C88  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 tcp\_nodelay  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 reusable connection: 1  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 post event 0920CD1C  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 delete posted event  
0920CD1C  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 http keepalive handler  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 malloc: 09220E70:1024  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv: fd:5 -1 of 1024  
2012/10/08 21:09:34 [debug] 13419#0: \*6056489 recv() not ready (11:  
Resource temporarily unavailable)  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 event timer del: 5:  
1125248440  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 http keepalive handler  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 close http connection: 5  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 reusable connection: 0  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 free: 09220E70  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 free: 00000000  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 free: 00000000  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 free: 09237C40, unused: 16  
2012/10/08 21:09:39 [debug] 13419#0: \*6056489 free: 091EE230, unused:  
188

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 5:51am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/4 "2012-10-09T05:51:40Z")

</div>

On Mon, October 8, 2012 10:55 pm, Ian M. Evans wrote:  
[snip]

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

Thanks.

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 10:26am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/5 "2012-10-09T10:26:48Z")

</div>

On Tue, October 9, 2012 3:57 am, Igor S. wrote:

> > > fastcgi\_cache\_path /var/lib/nginx/fastcgicache levels=1:2  
> > > }
> > 
> > fastcgi\_ignore\_headers Cache-Control Expires;  
> > 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”;

Thanks, Igor. It sort of worked. I’m now getting the custom 404, but  
it’s  
a cached version of the custom 404 php file.

That is, my custom 404 tells the visitor:

“Hmmmmthe page you’re looking for [/zap.shtml] doesn’t seem to be on  
our site. [etc, etc]” If I then do another file name that doesn’t exist,  
say, test1.shtml, I’m getting a cached version of the 404 as instead of  
saying test1.shtml, it still says “Hmmmmthe page you’re looking for [  
/zap.shtml ] doesn’t seem to be on our site.”

So, though it’s now serving the custom 404, it’s still serving a cached  
version. So I guess I need a way to turn off caching for the custom 404  
file. Just tried another one and, of course, got a cached 404 that  
someone  
else had just tried.

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 9:58am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/6 "2012-10-09T09:58:10Z")

</div>

On Mon, Oct 08, 2012 at 11:51:21PM -0400, Ian M. Evans wrote:

> > loader\_threshold=2000;  
> > Should I toss the custom 404 into a non-cached subdir?
> 
> 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 S.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 10:47am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/7 "2012-10-09T10:47:16Z")

</div>

On Oct 9, 2012, at 12:34 , Ian M. Evans wrote:

> location = /dhe404.shtml {  
> fastcgi\_pass 127.0.0.1:10004;  
> fastcgi\_cache\_valid 0s;  
> }
> 
> and made the cache valid 0. Seems to work.

location = /dhe404.shtml {  
fastcgi\_pass …  
fastcgi\_cache off;  
}

–  
Igor S.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 10:52am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/8 "2012-10-09T10:52:31Z")

</div>

On Tue, October 9, 2012 4:46 am, Igor S. wrote:

> > Think I solved the cached issue.  
> > location = /dhe404.shtml {  
> > fastcgi\_pass …  
> > fastcgi\_cache off;  
> > }

that’s better, thanks.

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [October 9, 2012, 10:34am UTC](https://www.ruby-forum.com/t/getting-built-in-404-instead-of-my-custom-one/223544/9 "2012-10-09T10:34:59Z")

</div>

On Tue, October 9, 2012 4:26 am, Ian M. Evans wrote:  
[snip]

> So, though it’s now serving the custom 404, it’s still serving a cached  
> version. So I guess I need a way to turn off caching for the custom 404  
> file. Just tried another one and, of course, got a cached 404 that someone  
> else had just tried.

Think I solved the cached issue.

Just created the location:

location = /dhe404.shtml {  
fastcgi\_pass 127.0.0.1:10004;  
fastcgi\_cache\_valid 0s;  
}

and made the cache valid 0. Seems to work.
