cascading error_page?

Jodok Batlogg jodok at lovelysystems.com
Fri Oct 26 18:03:35 MSD 2007


hi,

is it possible to create "cascading" error pages?

files are beeing requested like http://static.lovelybooks.de/covers/ 
9780/002/154/123/116x116.jpg

if the file is not beeing found under /covers/ (all dirs are  
numeric)  i'd like to look if the file is under /covers/btol/...
if it's not there under /covers/knv
and finally under /covers/lastone
if a file is not beeing found under /lastone i'd like to return a  
default image based on the requested size (3 possible sizes)

it seems like it's not possible to change the error page multiple times.
is it also possible to set a non-404 header? even if the result is  
beeing forwarded after an 404 error?

thanks

jodok


here's my try:

     location /covers/(0|1|2|3|4|5|6|7|8|9])* {
         autoindex on;
         expires 1w;
         root /var/www/static.lovelybooks.de/covers;
         rewrite ^/covers(.*)$ $1;
         error_page 404 /covers/btol$uri;
     }

     location /covers/btol {
         root /var/www/static.lovelybooks.de/covers/btol;
         rewrite ^/covers/btol(.*)$ $1;
         error_page 404 /covers/knv$uri;
     }

     location /covers/knv {
         root /var/www/static.lovelybooks.de/covers/btol;
         rewrite ^/covers/knv(.*)$ $1;
         error_page 404 /covers/lastone$uri;
     }

     location /covers/lastone {
         root /var/www/static.lovelybooks.de/covers;
         rewrite ^/covers/lastone(.*)$ $1;

         location ~ /42x42\.jpg$ {
             error_page 404 /error/covers/42x42.jpg;
         }
         location ~ /116x116\.jpg$ {
             error_page 404 /error/covers/116x116.jpg;
         }
         location ~ /170x170\.jpg$ {
             error_page 404 /error/covers/170x170.jpg;
         }
     }

--
"Readability counts."
   -- The Zen of Python, by Tim Peters

Jodok Batlogg, Lovely Systems
Schmelzhütterstraße 26a, 6850 Dornbirn, Austria
phone: +43 5572 908060, fax: +43 5572 908060-77


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2454 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx/attachments/20071026/b5138d58/attachment.bin>


More information about the nginx mailing list