summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoémi Ványi <kvch@users.noreply.github.com>2021-04-08 19:47:28 +0200
committerGitHub <noreply@github.com>2021-04-08 19:47:28 +0200
commita9a51ceb4887ef3d012cb5645d2cd6e6432c0cd2 (patch)
treecb640b570aff2f1aa190ce814201aed4a62af6bf
parent52e08ed777f005679f1ace632cbcf8147d54535f (diff)
parentc09ff4faf23fc13579ed350344de7f193a6b1869 (diff)
downloadsearxng-a9a51ceb4887ef3d012cb5645d2cd6e6432c0cd2.tar.gz
searxng-a9a51ceb4887ef3d012cb5645d2cd6e6432c0cd2.zip
Merge pull request #2733 from dalf/fix-2656
SCRIPT_NAME remove trailing slash to avoid infinite redirect
-rwxr-xr-xsearx/webapp.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 4c09f0ac6..072f140ca 100755
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -1133,11 +1133,14 @@ class ReverseProxyPathFix:
base_url = urlparse(settings['server']['base_url'])
self.script_name = base_url.path
+ if self.script_name.endswith('/'):
+ # remove trailing slash to avoid infinite redirect on the index
+ # see https://github.com/searx/searx/issues/2729
+ self.script_name = self.script_name[:-1]
self.scheme = base_url.scheme
self.server = base_url.netloc
def __call__(self, environ, start_response):
-
script_name = self.script_name or environ.get('HTTP_X_SCRIPT_NAME', '')
if script_name:
environ['SCRIPT_NAME'] = script_name