Is it possible to rewrite an error page in nginx config

Pardoner asked:

I have the following in my nginx config file.

error_page 503 http:path-to-my.rackcdn.com/maintenance.html;

Which servers up a static html file stored on Rackspace Cloudfiles. What I don’t like is how the url changes to …rackcdn.com. I’d rather rewrite the url so the domains appears to have stayed the same. Is it possible to rewrite error page url to something like

mydomain/maintanence

Thanks.

My answer:


Sorry, but in order to not have a client redirected to an external URL, you will have to host the file on your local filesystem. (Though any images, CSS etc. that it might load can remain on the CDN.)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.