SSI subrequest cannot work with "error page" directive?

nightsailer nightsailer at gmail.com
Wed May 21 20:07:47 MSD 2008


Hi, I have discovered a situation where nginx can't handle SSI
virtualtags right with "error page":

nginx is configured to serve local files, then fallback to proxy
remotefile,and then stored in local through "proxy_store":

root /cache/$host;
location / {
index index.shtml;
error_page 404 = /fetch$uri;
}
ssi on;
location /fetch {
internal;
proxy_pass <http://backend;>
proxy_store on;
proxy_store_access user:rw group:rw all:rw;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Via "s9/nginx";
alias /cache/$host;
}
location ~ /$ {
index index.shtml;
error_page 403 404 = @fetch;
}
location @fetch {
internal;
proxy_pass <http://backend;>
proxy_store /cache/$host${uri}index.shtml;
proxy_store_access user:rw group:rw all:rw;
proxy_set_header Host $host;
proxy_set_header Via "s9/nginx";
proxy_set_header X-Real-IP $remote_addr;
}

example,  there is index.shtml,like:

<body>
<!--# include virtual="/fragment/1.ssi" -->
..


nginx returns the page and then attempts to process the SSI virtual
tags. But, the virtual tags request can't redirect "/fragment/1.ssi" 
to internal location: 
"/fetch", it just report can't find "/fragment/1.ssi" . 
If I request the "/fragment/1.ssi" directly,
it works fine, it will proxy pass to backend,and store the content
into"/cache/host/fragment/1.ssi".

and, if I add:

location /fragment {
	proxy_pass <http://backend;>
	...
}

now, nginx will process index.shtml and return composed content right.

So,I wonder, does the subrequest to the SSI virtual tags can't handle
"error page" directive?

 


-- 

I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo







More information about the nginx mailing list