mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 12:40:06 -03:30
Fix bug in named url middleware when running at non-root path
The most notable change here is the removal of the conditional in process_request. I don't know why we were preferring REQUEST_URI over PATH_INFO. When the app is running at /, they are always the same as far as I can tell. However, when using SCRIPT_NAME, this was incorrectly setting path and path_info to /myprefix/myprefix/.
This commit is contained in:
@@ -180,11 +180,7 @@ class URLModificationMiddleware(MiddlewareMixin):
|
||||
return '/'.join(url_units)
|
||||
|
||||
def process_request(self, request):
|
||||
if hasattr(request, 'environ') and 'REQUEST_URI' in request.environ:
|
||||
old_path = urllib.parse.urlsplit(request.environ['REQUEST_URI']).path
|
||||
old_path = old_path[request.path.find(request.path_info) :]
|
||||
else:
|
||||
old_path = request.path_info
|
||||
old_path = request.path_info
|
||||
new_path = self._convert_named_url(old_path)
|
||||
if request.path_info != new_path:
|
||||
request.environ['awx.named_url_rewritten'] = request.path
|
||||
|
||||
Reference in New Issue
Block a user