#30634: "manage.py runserver" does not respect SCRIPT_NAME header
-------------------------------+--------------------------------------
     Reporter:  okainov        |                    Owner:  nobody
         Type:  Bug            |                   Status:  new
    Component:  HTTP handling  |                  Version:  2.2
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Description changed by okainov:

Old description:

> 0. Configure local nginx to emulate prod-like environment (i.e. when
> Django is running in Docker) and app should be in subfolder
>

> {{{
>  location /myapp/ {
>                 proxy_pass http://127.0.0.1:8000/;
>
>    #proxy_set_header X-Script-Name /myapp;
>     proxy_set_header SCRIPT_NAME /myapp;
>
>                 include proxy_params;
> }
> }}}
>

> 1. Run default Django app locally
> {{{
> manage.py runserver
> }}}
> 2. Debug any request and inspect request.META
> 3. Make sure request.META['SCRIPT_NAME'] is empty
>
> In the same time seems that running with uWSGI or something similar
> works. SO I assume the error is somewhere in `manage.py runserver`
> behavior
>

> Background:
> While I'm aware that `runserver` considered "insecure" and "slow", it
> doesn't really matter for me when I'm deploying small internal apps in my
> company (imagine ~10 users-app with <5 views). Since with `manage.py` I
> can run my app in "one click" and avoid hassle of separating static files
> serving and the main app, I would really like to keep it this way.

New description:

 0. Configure local nginx to emulate prod-like environment (i.e. when
 Django is running in Docker) and app should be in subfolder


 {{{
  location /myapp/ {
                 proxy_pass http://127.0.0.1:8000/;

    #proxy_set_header X-Script-Name /myapp;
     proxy_set_header SCRIPT_NAME /myapp;

                 include proxy_params;
 }
 }}}


 1. Run default Django app locally
 {{{
 manage.py runserver
 }}}
 2. Debug any request and inspect request.META
 3. Make sure `request.META['SCRIPT_NAME']` is empty

 In the same time seems that running with uWSGI or something similar works.
 SO I assume the error is somewhere in `manage.py runserver` behavior


 Background:
 While I'm aware that `runserver` considered "insecure" and "slow", it
 doesn't really matter for me when I'm deploying small internal apps in my
 company (imagine ~10 users-app with <5 views). Since with `manage.py` I
 can run my app in "one click" and avoid hassle of separating static files
 serving and the main app, I would really like to keep it this way.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30634#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.1f4b97fc08737094f4063ef79ca38850%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to