Skip to content

script alias sometimes cut off in generated paths #932

@aarongundel

Description

@aarongundel

Right now I've got a django app running with mod_wsgi. This is a piece of my setup...


        WSGIProcessGroup application_internal
        WSGIDaemonProcess application_internal python-path=/opt/application/ python-home=/opt/ENV processes=8
        WSGIScriptAlias /test/application_path /opt/application/wsgi.py process-group=application_internal
        WSGIPassAuthorization On

It works OK most of the time. The /test/application_path I've added to WSGIScriptAlias was requested by a client. I added it so that I could serve the application at

http://application.com/test/application_path
instead of
https://application.com/

However, I've noticed that sometimes the links generated by my application are invalid - and by invalid I mean they leave out the script alias path. So I'll get links like
https://application.com/index.html
instead of
https://application.com/test/application_path/index.html

Maddeningly, this behavior's inconsistent. Usually I get valid paths - but sometimes I don't. I've partially worked around it by creating a rewrite rule with mod_rewrite to correct the paths. This works well for the domain I'm hosting it at and I'm always able to get everything to load as expected. But there's yet another wrinkle as the site is also served up via reverse proxy to an external domain. Since the reverse proxy is configured not to rewrite any links on these pages and just forward everything at /test/application_path to my server, if my server generates invalid links (as above) they direct to the wrong part of the non-proxied site and 404.

Hopefully this all makes sense. I don't think I'm doing anything unusual/exotic. When I run this setup with a script alias path (just / ) everything is fine. I never had this problem before I added /test/application_path to the script alias. Any insight into where I might look for issues in either my mod_wsgi config or elsewhere would be much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions