Tornado で 401 ステータス コードを送信しても、IE/Firefox でパスワード プロンプトが表示されません。
import tornado.ioloop
import tornado.web
class UserHandler(tornado.web.RequestHandler):
def get(self, user_id):
self.set_header('WWW-Authenticate', 'Basic realm="users"')
self.send_error(status_code=401)
application = tornado.web.Application([
(r"/users/(\w+)", UserHandler),
],debug=True)
if __name__ == "__main__":
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
さらに、WWW-Authenticate ヘッダーは応答ヘッダーに表示されません。401 ステータスを送信しない場合、ヘッダーには表示されますが、パスワード プロンプトは表示されません。