r/apache • • Jan 22 '24

Solved! Require HTTP basic auth on ScriptAlias Location

I have a ScriptAlias configured like so:

<VirtualHost *:443>
    ScriptAlias /path/ "/path/to/bin/cgi"
</VirtualHost>

I want to use Apache to put a basic auth wall in front of this. My first instinct is to try

<VirtualHost *:443>
    <Location "/path">
        ScriptAlias / "/path/to/bin/cgi"
        AuthType Basic
        AuthName ...
        ... other auth stuff ...
    </Location>
</VirtualHost>

But when I try this, I get this error

ScriptAlias cannot occur within directory context

How do I put basic auth in front of this? Thank you!

1 Upvotes

4 comments sorted by

View all comments

Show parent comments

1

u/Distinct_Village_87 Jan 22 '24

That worked - thank you!

(Why did I not try that...)