Re: Problem with uWSGI and PATH_INFO

2017-08-08 Thread Francis Daly
On Sun, Aug 06, 2017 at 12:28:11PM +0200, Roberto De Ioris wrote: > > On Sat, Aug 05, 2017 at 11:47:24AM -0400, Etienne Robillard wrote: Hi there, > nginx is not able to correctly split PATH_INFO accordingly to SCRIPT_NAME That is correct. It is similarly correct that nginx is not able to know

Re: Problem with uWSGI and PATH_INFO

2017-08-07 Thread Etienne Robillard
Hi Roberto, Le 2017-08-06 à 10:09, Roberto De Ioris a écrit : Neither of the two, you were asking about mounting in a sub-uri in the previous posts, that requires some kind of ruling. For mounting under / (or empty SCRIPT_NAME to be more compliant with WSGI) you do not need additional configura

Re: Problem with uWSGI and PATH_INFO

2017-08-06 Thread Roberto De Ioris
> So either Django is not a compliant WSGI app or uWSGI is unable to mount > a standard WSGI application to the root location in nginx without using > magic rewrites? > > Eienne > Neither of the two, you were asking about mounting in a sub-uri in the previous posts, that requires some kind of rul

Re: Problem with uWSGI and PATH_INFO

2017-08-06 Thread Etienne Robillard
So either Django is not a compliant WSGI app or uWSGI is unable to mount a standard WSGI application to the root location in nginx without using magic rewrites? Eienne Le 2017-08-06 à 06:28, Roberto De Ioris a écrit : This is what any compliant WSGI server (included uWSGI) expects: https:/

Re: Problem with uWSGI and PATH_INFO

2017-08-06 Thread Roberto De Ioris
> 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

Re: Problem with uWSGI and PATH_INFO

2017-08-06 Thread Francis Daly
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

Re: Problem with uWSGI and PATH_INFO

2017-08-05 Thread Etienne Robillard
Hi, The workaround suggested below is not working. 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? Etienne Le 2017-07

Re: Problem with uWSGI and PATH_INFO

2017-07-29 Thread Etienne Robillard
Hi Francis, Le 2017-07-28 à 03:17, Francis Daly a écrit : What I meant there was that you could possibly use fastcgi_split_path_info to define how you want your $request_uri to be split into parts for your SCRIPT_NAME and PATH_INFO as uwsgi_param values. So your eventual config could include

Re: Problem with uWSGI and PATH_INFO

2017-07-28 Thread Roberto De Ioris
> Hi Roberto, > > Le 2017-07-27 à 13:45, Roberto De Ioris a écrit : >> >> by using something like this (in the config, tune the regexps as >> required): >> >> [uwsgi] >> route = ^/(.+?)/(.+)$ setscriptname:/$1 >> route = ^/(.+?)/(.+)$ setpathinfo:/$2 >> > I use a dynamic regex URL resolver to reso

Re: Problem with uWSGI and PATH_INFO

2017-07-28 Thread Francis Daly
On Thu, Jul 27, 2017 at 12:06:42PM -0400, Etienne Robillard wrote: > Le 2017-07-27 à 11:25, Francis Daly a écrit : > >On Thu, Jul 27, 2017 at 07:45:28AM -0400, Etienne Robillard wrote: Hi there, > >The uwsgi_params values are an example of what can be done. The > >combination of SCRIPT_NAME and P

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Etienne Robillard
Hi Roberto, Le 2017-07-27 à 13:45, Roberto De Ioris a écrit : by using something like this (in the config, tune the regexps as required): [uwsgi] route = ^/(.+?)/(.+)$ setscriptname:/$1 route = ^/(.+?)/(.+)$ setpathinfo:/$2 I use a dynamic regex URL resolver to resolve a request URI to a cal

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Roberto De Ioris
> Hi Roberto, > > That is not effective. My app uses PATH_INFO to resolve a URL (ie: > /blog/create/) to a callback function. > > Could it be possible to just use : > > uwsgi_param PATH_INFO $path_info > > Assuming $path_info is the request_uri minus the location... > > E > Nope, as already said

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Etienne Robillard
Hi Roberto, That is not effective. My app uses PATH_INFO to resolve a URL (ie: /blog/create/) to a callback function. Could it be possible to just use : uwsgi_param PATH_INFO $path_info Assuming $path_info is the request_uri minus the location... E Le 2017-07-27 à 12:47, Roberto De Ioris a

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Roberto De Ioris
> Hi all, > > Le 2017-07-27 à 11:25, Francis Daly a écrit : >> On Thu, Jul 27, 2017 at 07:45:28AM -0400, Etienne Robillard wrote: >> >> Hi there, >> >>> I'm not sure I understand the logic of this. Can someone please >>> explain why the variable PATH_INFO is set to $document_uri in >>> uwsgi_param

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Etienne Robillard
Hi all, Le 2017-07-27 à 11:25, Francis Daly a écrit : On Thu, Jul 27, 2017 at 07:45:28AM -0400, Etienne Robillard wrote: Hi there, I'm not sure I understand the logic of this. Can someone please explain why the variable PATH_INFO is set to $document_uri in uwsgi_params? My guess (without kno

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Francis Daly
On Thu, Jul 27, 2017 at 07:45:28AM -0400, Etienne Robillard wrote: Hi there, > I'm not sure I understand the logic of this. Can someone please > explain why the variable PATH_INFO is set to $document_uri in > uwsgi_params? My guess (without knowing the history): The uwsgi_params values are an e

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Roberto De Ioris
> Hi Roberto, > > > Le 2017-07-27 à 09:52, Roberto De Ioris a écrit : >> >>> Hi again, this is not what manage-script-name is for. It is a >>> uWSGI-specific option for when you only PATH_INFO and you want to >>> generate >>> SCRIPT_NAME accordingly. This requires to "mount" apps under specific >>

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Etienne Robillard
Hi Roberto, Le 2017-07-27 à 09:52, Roberto De Ioris a écrit : Hi again, this is not what manage-script-name is for. It is a uWSGI-specific option for when you only PATH_INFO and you want to generate SCRIPT_NAME accordingly. This requires to "mount" apps under specific paths. Ok. I really don

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Roberto De Ioris
> Hi Roberto, > > I use gevent-fastcgi for production. I wish to have the time to dive in > the internals of uWSGI to understand how PATH_INFO and SCRIPT_NAME gets > rewritten by uWSGI. I believe the implementation of --manage-script-name > is incorrect and should be fixed to support having a empt

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Etienne Robillard
Hi Roberto, I use gevent-fastcgi for production. I wish to have the time to dive in the internals of uWSGI to understand how PATH_INFO and SCRIPT_NAME gets rewritten by uWSGI. I believe the implementation of --manage-script-name is incorrect and should be fixed to support having a empty or not

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Roberto De Ioris
> Hi Roberto, > > My Django app runs perfectly ok under FastCGI and nginx but is not > capable of resolving the proper PATH_INFO under uWSGI. In > fastcgi_params, the value of PATH_INFO and SCRIPT_NAME are set to > "$fastcgi_script_name". My nginx config looks like this: > > location / { > > uws

Re: Problem with uWSGI and PATH_INFO

2017-07-27 Thread Etienne Robillard
Hi Roberto, My Django app runs perfectly ok under FastCGI and nginx but is not capable of resolving the proper PATH_INFO under uWSGI. In fastcgi_params, the value of PATH_INFO and SCRIPT_NAME are set to "$fastcgi_script_name". My nginx config looks like this: location / { uwsgi_pass django

Problem with uWSGI and PATH_INFO

2017-07-27 Thread Etienne Robillard
Hi, uWSGI apparently does some weird voodoo tricks to manage SCRIPT_NAME and PATH_INFO when using nginx: "The WSGI standard dictates that |SCRIPT_NAME| is the variable used to select a specific application. Unfortunately u nginx is not able to rewrite PATH_INFO accordingly to SCRIPT_NAME. For s