Re: [modwsgi] add WSGIScriptAlias from one directory to another

44 views
Skip to first unread message

Graham Dumpleton

unread,
Oct 4, 2012, 8:37:43 PM10/4/12
to mod...@googlegroups.com
Can you provide the actual Apache configuration showing mod_wsgi
directives and any Alias directives corresponding to the protected
directory. Ensure that you preserve the order in which they appear in
the file.

Graham

On 5 October 2012 08:51, Jeff Dyke <jeff...@gmail.com> wrote:
> I have a protected directory, say http://example.com/protected
> This has indexing enabled and people use it to download files and its
> protected by Basic Authentication
>
> I would like to use WSGIScriptAlias to send any requests to
> /protected/python_file to /server/root/python/python_file.py Which already
> exists in another conainter and services requests all day. Ultimately what
> i'm trying to do is take advantage of the Basic Auth, but allow them (after
> authentication) to have access to python_file.py
>
> I have tried this:
> WSGIScriptAlias /protected/python_file /server/root/python/python_file.py,
> but this seems to return a 404, seemingly from WSGI b/c its different then
> apache's 404 page
>
> If it call http://example.com/protected/python_file it gives me simply
> "Could not Find:", which i assume comes from WSGI, if i add .py
> (http://example.com/protected/python_file.py) i get apache's 404 page.
>
> Ultimately the question is, is this set up possible, both to have them
> authenticate and to execute a python file, via POST, that is not in the
> /protected/ directory.
>
> Hope i explained that OK and thanks for any pointers.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/ao5WQGyab9wJ.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Jeff Dyke

unread,
Oct 5, 2012, 8:38:18 AM10/5/12
to mod...@googlegroups.com
Thanks for the response Graham, given your questions i trimmed down and reworked my vhost config and found my mistake.  First it ran the script, but did not require authentication to the WSGIScriptAlias target, but did require auth if you requested the directory contents (which it should). As soon as i changed the container requiring authentication to a <Location> and not a <Directory>, it worked as desired/hoped/thought.

Thanks
Jeff

Relevant config for anyone who comes across a similar issue.  This is inside a normal <VirtualHost> container

 <Location /protected >
        AuthType Basic
        Options +Indexes
        IndexOptions FancyIndexing
        AuthName "Restricted Files"
        Require group filefeed
        AuthUserFile /app/pfe/.htpasswd
        AuthGroupFile /app/file-feed-group
</Location>
WSGIDaemonProcess example.net processes=2 threads=15 display-name=%{GROUP} python-eggs=/app/.python_eggs
WSGIProcessGroup example.net
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias /protected/inquiry /app/root/export/wsgi/inquiry.py
Reply all
Reply to author
Forward
0 new messages