Skip to content

Commit 9a818de

Browse files
mehalternaveg
andcommitted
Send WWW-Authenticate header with 401 responses
Co-authored-by: Evan Goldenberg <evangoldenberg@gmail.com>
1 parent 1129a85 commit 9a818de

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cps/error_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
# custom error page
2323

2424
def error_http(error):
25+
headers = {'WWW-Authenticate': 'Basic realm="calibre-web"'} if error.code == 401 else {}
2526
return render_template('http_error.html',
2627
error_code="Error {0}".format(error.code),
2728
error_name=error.name,
2829
issue=False,
2930
unconfigured=not config.db_configured,
3031
instance=config.config_calibre_web_title
31-
), error.code
32+
), error.code, headers
3233

3334

3435
def internal_error(error):

0 commit comments

Comments
 (0)