Updated redirect code used in https redirects

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections

301 redirections do not keep the request method intact, and can occasionally be changed from POST to GET

308 redirections always keep the request method, which is necessary for all POST search requests
main
Ben Busby 2020-05-16 09:31:07 -06:00 committed by GitHub
parent 601923e074
commit a4382d59f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -25,7 +25,7 @@ def before_request_func():
if https_only and request.url.startswith('http://'): if https_only and request.url.startswith('http://'):
url = request.url.replace('http://', 'https://', 1) url = request.url.replace('http://', 'https://', 1)
code = 301 code = 308
return redirect(url, code=code) return redirect(url, code=code)
json_config = json.load(open(CONFIG_PATH)) if os.path.exists(CONFIG_PATH) else {'url': request.url_root} json_config = json.load(open(CONFIG_PATH)) if os.path.exists(CONFIG_PATH) else {'url': request.url_root}