在我使用 mod_wsgi 和 Apache 上的 cherrypy 的 python 应用程序中,我的响应代码从 403 更改为 500。我明确地将其设置为 403。
即cherrypy.response.status = 403
我不明白客户端收到的响应代码在哪里以及为什么是 500。有没有人有这个问题的经验>
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.