Redirect from falcon authenticate

二次信任 提交于 2019-12-11 14:06:19

问题


In my falcon app I want to redirect to another page from the authenticate function.

I am doing this:

resp.status = falcon.HTTP_301
resp.set_header('Location', '/http://foo.bar.com:8004/falcon_passthrough/')

But it still calls the underlying endpoint on return and does not redirect.

Is there a way to cause this redirect and not call the underlying endpoint?


回答1:


If you are using 1.0.0rc1 just do:

raise falcon.HTTPMovedPermanently(location)


来源:https://stackoverflow.com/questions/37300822/redirect-from-falcon-authenticate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!