summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2020-11-04 17:32:51 +0100
committerAdam Tauber <asciimoo@gmail.com>2020-11-05 16:14:23 +0100
commit063260d090d175f010f42270664d476bb8039801 (patch)
tree938ca4d6524a4395b4b0a02ca913d42e4c2c961d /searx/webapp.py
parentc03e4c86bc49d6ef4664c038066d9f1c16e7dafc (diff)
downloadsearxng-063260d090d175f010f42270664d476bb8039801.tar.gz
searxng-063260d090d175f010f42270664d476bb8039801.zip
[enh] add default http headers - closes #715
Diffstat (limited to 'searx/webapp.py')
-rwxr-xr-xsearx/webapp.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 46d547d52..d68ae349a 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -488,6 +488,16 @@ def pre_request():
@app.after_request
+def add_default_headers(response):
+ # set default http headers
+ for header, value in settings['server'].get('default_http_headers', {}).items():
+ if header in response.headers:
+ continue
+ response.headers[header] = value
+ return response
+
+
+@app.after_request
def post_request(response):
total_time = time() - request.start_time
timings_all = ['total;dur=' + str(round(total_time * 1000, 3))]