1

I have deployed a WSGI application in Apache2 with mod_wsgi.

The application is made so that it responds with a 400 response code if the data provided by the user in a form is invalid. The response also contains the HTML with the form and invalid fields highlighted so that the user may correct the data.

This works flawlessly using development servers like Waitress. But when deployed in Apache with a quite standard configuration; Apache swallows the HTML and thus hampers the client's ability to correct his/her mistake.

Is there a way to configure Apache so that Error Messages come from the WSGI Application?

1 Answer 1

1

It should by default always pass back the response from the WSGI application.

There are only two ways I can see this being otherwise.

The first is that you are using mod_wsgi daemon mode and have set an obscure directive for mod_wsgi, that isn't even listed in the mod_wsgi documentation, called WSGIErrorOverride. This would allow Apache itself to override any error response for which an ErrorDocument directive was specified.

The second is that you have some special Apache module installed which implements an output filter which is replacing the response on the fly when it sees certain HTTP error responses.

I don't actually now of any standard Apache module which does the latter, although technically possible. Do you perhaps run PHP on the same Apache installation, because it can run as an output filter, it is possible I guess that it has been set up to override the response.

Anyway, can you perhaps describe the mod_wsgi parts of your Apache configuration.

3
  • Solved! Just placing WSGIErrorOverride Off, solved the issue. Actually it was On, it seems I have misunderstood some tip someone gave me.
    – manu
    Mar 11, 2014 at 23:25
  • The default for WSGIErrorOverride is Off so you can simply remove it from the configuration. Mar 12, 2014 at 0:40
  • In this case I'll stick with the "explicit is better than implicit" thing. Someone before me put the "WSGIErrorOverride On" for some reason (probably a habit), so a big "# XXX Don't make this On or bad things will happen" is in order ;)
    – manu
    Mar 17, 2014 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .