forked from Ponysearch/Ponysearch
[fix] fix PR 2656
SCRIPT_NAME remove trailing slash to avoid infinite redirect
This commit is contained in:
parent
07f5edce3d
commit
c09ff4faf2
1 changed files with 4 additions and 1 deletions
|
@ -1133,11 +1133,14 @@ class ReverseProxyPathFix:
|
||||||
|
|
||||||
base_url = urlparse(settings['server']['base_url'])
|
base_url = urlparse(settings['server']['base_url'])
|
||||||
self.script_name = base_url.path
|
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.scheme = base_url.scheme
|
||||||
self.server = base_url.netloc
|
self.server = base_url.netloc
|
||||||
|
|
||||||
def __call__(self, environ, start_response):
|
def __call__(self, environ, start_response):
|
||||||
|
|
||||||
script_name = self.script_name or environ.get('HTTP_X_SCRIPT_NAME', '')
|
script_name = self.script_name or environ.get('HTTP_X_SCRIPT_NAME', '')
|
||||||
if script_name:
|
if script_name:
|
||||||
environ['SCRIPT_NAME'] = script_name
|
environ['SCRIPT_NAME'] = script_name
|
||||||
|
|
Loading…
Reference in a new issue