Problem with uWSGI and PATH_INFO
Roberto De Ioris
roberto at unbit.it
Sun Aug 6 10:28:11 UTC 2017
> On Sat, Aug 05, 2017 at 11:47:24AM -0400, Etienne Robillard wrote:
> Hi there,
>> The workaround suggested below is not working.
> From the words here, it is not clear to me what specific configuration
> you are using.
>> The only case where
>> Django correctly handle uWSGI transport is when PATH_INFO is set to
>> DOCUMENT_URI in uwsgi_params. So can someone please explain how to
>> set uWSGI to run a WSGI app in FastCGI (backward-compatible) mode?
> I don't know enough about Django to understand that question.
> I do know enough about nginx to believe that nginx does not care what
> Django does.
> The only thing that seems to be missing, from an nginx perspective, is:
> what does the uwsgi-server want to receive for this request?
> That is:
>> >>It all comes down to: for one specific http request, what values do
>> >>you want SCRIPT_NAME and PATH_INFO to have when they are sent to the
>> >>uwsgi upstream?
> If someone will provide one explicit example of what behaviour is wanted,
> then it may be clear what the appropriate nginx config for this case is.
This is what any compliant WSGI server (included uWSGI) expects:
nginx is not able to correctly split PATH_INFO accordingly to SCRIPT_NAME
(and technically it should not do it as uwsgi is a transport only protocol
and the server could make any kind of assumptions about variables).
For this reason you need to instruct uWSGI to rewrite PATH_INFO
accordingly (like shown in the previous posts). There can be no magic in
uWSGI to rewrite it as it would mean infering what the user want to do.
The solution is using uWSGI to rewrite it (it has at least 3 ways)
Unfortunately i am not able to help better :)
Roberto De Ioris
More information about the nginx