mod_wsgi icon indicating copy to clipboard operation
mod_wsgi copied to clipboard

Is WSGIErrorOverride supported?

Open akrherz opened this issue 2 years ago • 8 comments

The release notes for 3.0 have this blurb

  1. Implement WSGIErrorOverride directive which when set to On will result in Apache error documents being used rather than those passed back by the WSGI application. This allows error documents to match any web site that the WSGI application may be integrated as a part of. This feature is akin to the ProxyErrorOverride directive of Apache but for mod_wsgi only. Do note though that this feature has only been implemented for mod_wsgi daemon mode. See:

http://code.google.com/p/modwsgi/issues/detail?id=57

But the configuration page does not list this directive as an option.

  • Is it supported?
  • Does it work outside of daemon mode? If not, is there a github issue akin to that defunct google code link?

Thank you.

akrherz avatar Mar 02 '23 20:03 akrherz

Oh, seems nothing was ever added to docs for it.

It does not work outside of daemon mode as there is no easy way with Apache internal request handling to really replace wholesale the existing response when in embedded mode.

The feature was intended to originally work like:

  • https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxyerroroverride

but only for daemon mode.

Note though that although ProxyErrorOverride in Apache 2.4 allows you to specify specific error codes to be replaced, in mod_wsgi it doesn't since when originally added Apache did not support doing it for specific error codes so never considered it. Am not sure how hard would be to allow specific errors to be listed.

Anyway, whether the directive still works am not sure since have probably never tried it since was added. Are you having a specific issue with it?

GrahamDumpleton avatar Mar 02 '23 21:03 GrahamDumpleton

Working link for that old Google Code site issue is:

  • https://code.google.com/archive/p/modwsgi/issues/57

GrahamDumpleton avatar Mar 02 '23 21:03 GrahamDumpleton

Thank you for the detailed response!

Anyway, whether the directive still works am not sure since have probably never tried it since was added. Are you having a specific issue with it?

It appears to be working as intended in daemon mode.

akrherz avatar Mar 02 '23 21:03 akrherz

Note though that although ProxyErrorOverride in Apache 2.4 allows you to specify specific error codes to be replaced, in mod_wsgi it doesn't since when originally added Apache did not support doing it for specific error codes so never considered it. Am not sure how hard would be to allow specific errors to be listed.

Turns out that I could really use this feature, so if you are still interested in considering it :)

akrherz avatar Mar 11 '23 12:03 akrherz

As far as I know it isn't possible to implement it for embedded mode.

Why are you using embedded mode anyway? You should always use daemon mode unless you have quite specific requirements that need it and your application works well enough that it can survive without all the benefits you get from daemon mode around auto recovery of stuck processes, request timeouts etc.

GrahamDumpleton avatar Mar 12 '23 22:03 GrahamDumpleton

Why are you using embedded mode anyway?

Sorry if I was confusing, but I am using daemon mode.

akrherz avatar Mar 13 '23 11:03 akrherz

If you are using daemon mode, then I am confused why you would want that feature implemented for embedded mode.

GrahamDumpleton avatar Mar 13 '23 19:03 GrahamDumpleton

If you are using daemon mode, then I am confused why you would want that feature implemented for embedded mode.

Sorry to continue to confuse you, I am asking for ProxyErrorOverride to allow specifying which error codes to override.

akrherz avatar Mar 14 '23 00:03 akrherz