Opened 5 years ago

Closed 5 years ago

#30634 closed Bug (wontfix)

"manage.py runserver" does not respect SCRIPT_NAME header.

Reported by: Oleg Kainov Owned by: nobody
Component: HTTP handling Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Oleg Kainov)

  1. 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.

Change History (2)

comment:1 by Oleg Kainov, 5 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 5 years ago

Resolution: wontfix
Status: newclosed
Summary: "manage.py runserver" does not respect SCRIPT_NAME header"manage.py runserver" does not respect SCRIPT_NAME header.
Version: 2.2master

I'm sorry but "... improving this server to be able to handle a production environment is outside the scope of Django." (see documentation).

Note: See TracTickets for help on using tickets.
Back to Top