Skip to content

Commit

Permalink
[webrecorder#715] forward custom http headers when querying the index
Browse files Browse the repository at this point in the history
In particular the X-Pywb-ACL-User header must be forwarded in order
for it to be able to control CDX-queries
  • Loading branch information
krakan committed Feb 13, 2023
1 parent d9db8ea commit 8e547a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pywb/apps/frontendapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,11 @@ def serve_cdx(self, environ, coll='$root'):
cdx_url += 'limit=' + str(self.query_limit)

try:
res = requests.get(cdx_url, stream=True)
headers = {}
for key in environ.keys():
if key.startswith("HTTP_X_"):
headers[key[5:].replace("_", "-")] = environ[key]
res = requests.get(cdx_url, stream=True, headers=headers)

status_line = '{} {}'.format(res.status_code, res.reason)
content_type = res.headers.get('Content-Type')
Expand Down

0 comments on commit 8e547a8

Please sign in to comment.