1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

is-ajax check: only check Sec-Fetch-Mode in proxy mode, only treat 'cors' as ajax, fixes change in #563 (#566)

This commit is contained in:
Ilya Kreymer 2020-06-08 14:45:41 -07:00 committed by GitHub
parent 3c53c2731b
commit 8a6475a9c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -837,10 +837,15 @@ class RewriterApp(object):
if value and value.lower() == 'xmlhttprequest':
return True
# if Chrome Sec-Fetch-Mode is set and is not 'navigate', then this is likely
# additional checks for proxy mode only
if not ('wsgiprox.proxy_host' in environ):
return False
# if Chrome Sec-Fetch-Mode is set and is set to 'cors', then
# a fetch / ajax request
sec_fetch_mode = environ.get('HTTP_SEC_FETCH_MODE')
if sec_fetch_mode and sec_fetch_mode != 'navigate':
if sec_fetch_mode and sec_fetch_mode == 'cors':
return True
return False