开发者

CherryPy changes my response code

开发者 https://www.devze.com 2022-12-17 20:32 出处:网络
In my python application using mod_wsgi and cherrypy ontop of Apache my response code get changed to开发者_如何学C a 500 from a 403.I am explicitly setting this to 403.

In my python application using mod_wsgi and cherrypy ontop of Apache my response code get changed to开发者_如何学C 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>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消