diff options
| -rw-r--r-- | docs/admin/installation-searx.rst | 2 | ||||
| -rw-r--r-- | docs/dev/makefile.rst | 2 | ||||
| -rw-r--r-- | searx/settings.yml | 6 | ||||
| -rwxr-xr-x | searx/webapp.py | 10 |
4 files changed, 18 insertions, 2 deletions
diff --git a/docs/admin/installation-searx.rst b/docs/admin/installation-searx.rst index f1d486021..a368bfe8c 100644 --- a/docs/admin/installation-searx.rst +++ b/docs/admin/installation-searx.rst @@ -52,7 +52,7 @@ In the same shell create *virtualenv*: :end-before: END create virtualenv To install searx's dependencies, exit the searx *bash* session you opened above -and restart a new. Before install, first check if your *virualenv* was sourced +and restart a new. Before install, first check if your *virtualenv* was sourced from the login (*~/.profile*): .. kernel-include:: $DOCS_BUILD/includes/searx.rst diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst index 62cd0a984..699729a28 100644 --- a/docs/dev/makefile.rst +++ b/docs/dev/makefile.rst @@ -68,7 +68,7 @@ Python environment ``source ./local/py3/bin/activate`` -With Makefile we do no longer need to build up the virualenv manually (as +With Makefile we do no longer need to build up the virtualenv manually (as described in the :ref:`devquickstart` guide). Jump into your git working tree and release a ``make pyenv``: diff --git a/searx/settings.yml b/searx/settings.yml index 54352bbfc..5cab0a102 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -17,6 +17,12 @@ server: image_proxy : False # Proxying image results through searx http_protocol_version : "1.0" # 1.0 and 1.1 are supported method: "POST" # POST queries are more secure as they don't show up in history but may cause problems when using Firefox containers + default_http_headers: + X-Content-Type-Options : nosniff + X-XSS-Protection : 1; mode=block + X-Download-Options : noopen + X-Robots-Tag : noindex, nofollow + Referrer-Policy : no-referrer ui: static_path : "" # Custom static path - leave it blank if you didn't change diff --git a/searx/webapp.py b/searx/webapp.py index 035e039f0..9aa80906a 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))] |