This commit is contained in:
yumoqing 2024-02-17 19:26:53 +08:00
parent fa41aace4c
commit 05b96e89ab

View File

@ -384,15 +384,17 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
return url return url
scheme = request.headers.get('X-Forwarded-Scheme') or request.scheme scheme = request.headers.get('X-Forwarded-Scheme') or request.scheme
port = request.headers.get('X-Forwarded-Port') or str(request['port']) port = request.headers.get('X-Forwarded-Port') or str(request['port'])
prepath = request.headers.get('X-Forwarded-Prepath') or ''
if prepath != '':
prepath = f'/{prepath}'
h = self.gethost(request) h = self.gethost(request)
if url.startswith('/'): if url.startswith('/'):
return f'{scheme}://{h}:{port}{url}' return f'{scheme}://{h}:{port}{url}{prepath}'
path = request.path path = request.path
if self.request_filename and os.path.isdir(self.request_filename): if self.request_filename and os.path.isdir(self.request_filename):
path = '%s/oops' % path path = '%s/oops' % path
p = self.relatedurl(path,url) p = self.relatedurl(path,url)
return f'{scheme}://{h}:{port}{p}' return f'{scheme}://{h}:{port}{prepath}{p}'
return '%s://%s:%s%s' % (scheme, h, port, p)
async def path_call(self, request, path, params={}): async def path_call(self, request, path, params={}):
url = self.entireUrl(request, path) url = self.entireUrl(request, path)