Suggestions on how to have error pages based on content type

Phillip Oldham phill at activityhq.com
Tue Oct 27 11:02:13 MSK 2009


How about this (not tested)?
>    error_page   503 @maintenance;
>
>    location @maintenance {
>      auth_basic off;
>      root /var/www/foobar/nginx_error_test/system;
>
>      if ($content_type ~* javascript) {
>        rewrite . /system/maintenance.json last;
>      }
>
>      if ($content_type ~* xml) {
>        rewrite . /system/maintenance.xml last;
>      }
>
>      rewrite . /system/maintenance.html last;
>    }
>
>    if (-f $request_filename) {
>       break;
>    }
>
>    if (-f $request_filename.html) {
>       rewrite (.*) $1.html last;
>    }
>
> }


-- 

*Phillip B Oldham*
ActivityHQ
phill at activityhq.com <mailto:phill at theactivitypeople.co.uk>

------------------------------------------------------------------------

*Policies*

This e-mail and its attachments are intended for the above named 
recipient(s) only and may be confidential. If they have come to you in 
error, please reply to this e-mail and highlight the error. No action 
should be taken regarding content, nor must you copy or show them to anyone.

This e-mail has been created in the knowledge that Internet e-mail is 
not a 100% secure communications medium, and we have taken steps to 
ensure that this e-mail and attachments are free from any virus. We must 
advise that in keeping with good computing practice the recipient should 
ensure they are completely virus free, and that you understand and 
observe the lack of security when e-mailing us.

------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20091027/196fc54a/attachment.html>


More information about the nginx mailing list