Skip to content

Commit 987e700

Browse files
Merge pull request #876 from mehalter/authenticated-header
Send WWW-Authenticate header with 401 responses
2 parents 7c49f5c + 2070b6f commit 987e700

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CONTRIBUTORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Copyright (C) 2024-2026 Calibre-Web Automated contributors
312312
- zhiyue (1 commits)
313313
# Fork Contributors (crocodilestick/calibre-web-automated)
314314

315-
- crocodilestick (892 commits)
315+
- crocodilestick (896 commits)
316316
- jmarmstrong1207 (73 commits)
317317
- demitrix (30 commits)
318318
- sirwolfgang (29 commits)

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': f'Basic realm="{config.config_calibre_web_title or "calibre-web-automated"}"'} 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)