Some of the information here may be outdated, please check the book instead

When requesting an invalid page web2py generates a default 400 error page.

This can be overwritten. There are at least three ways:

1) If you use mod_proxy you can set in the apache config file

ProxyErrorOverride On

Then you can filter error messages using mod_include SSI and render them as you like.

2) You create a file in web2py/ as discussed in a previous post. You need to explicitly list all the allowed routes and add a catch all invalid routes at the end, for example:


will render all invalid urls as '/examples/default/index'

3) On error web2py also adds a header web2py_error to the http response. You can easily create wsgi app that wraps web2py wsgibase and filters response accodingly.

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.