views:

53

answers:

1

In my python application using mod_wsgi and cherrypy ontop of Apache my response code get changed to a 500 from a 403. I am explicitly setting this to 403.

i.e. cherrypy.response.status = 403

I do not understand where and why the response code that the client receives is 500. Does anyone have any experience with this problem>

A: 

The HTTP 500 error is used for internal server errors. Something in the server or your application is likely throwing an exception, so no matter what you set the response code to be before this, CherryPy will send a 500 back.

You can look into whatever tools CherryPy includes for debugging or logging (I'm not familiar with them). You can also set breakpoints into your code and continue stepping into the CherryPy internals until it hits the error case.

Michael Greene
Yes, look in Apache error logs because if the 500 error is coming from CherryPy framework base or mod_wsgi, there should be a message about it there.
Graham Dumpleton
The logs show no issues. Its seems like mod_wsgi is taking my url and somehow redirecting it but I have no idea why and how to debug this.
Mohan Gulati