Skip to content

Feature Request: Support Separating SCRIPT_NAME and PATH_INFO in Python #590

Closed
@OutOfFocus4

Description

@OutOfFocus4

I am requesting that Python module be updated to accept an optional script-name variable that is passed to WSGI applications in the SCRIPT_NAME environment variable, and that the PATH_INFO environment variable be updated to not start with the script-name path.

Currently, WSGI applications in Nginx Unit are passed the full request path in the PATH_INFO variable, even if the application can only be accessed on non-root paths. This differs from the behavior of Apache's mod_wsgi, which puts part of the path in SCRIPT_NAME and the remaining part in PATH_INFO.

The behavior of mod_wsgi means that a Django application only needs to be designed to handle its own URL routes, such as /admin/, but can be accessed using Apache at paths such as /django-app/admin/ without any changes to the application.

Because Nginx Unit puts the full path in the PATH_INFO variable, a Django application accessible at a non-root path such as /django must be configured to strip /django from the path before determining how to route the request, and if Unit is reconfigured to place the application under /app, the Django application would also need to be updated.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions