Mohan Gulati
Mohan Gulati

Reputation: 28209

CherryPy changes my response code

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>

Upvotes: 3

Views: 1883

Answers (1)

Michael Greene
Michael Greene

Reputation: 10423

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.

Upvotes: 1

Related Questions