<Location /url> stanza and ProxyPass overtaking sub-locations with <RequireAny> in Apache 2.2

104 Views Asked by At

First off, thank you for looking at my post. This pickle has me hitting my head against the wall.

Long story short, I've got an app that requires Apache 2.2 and has strict requirements for allowing certain IP addresses through.

My goal is for Apache to allow anyone to access one specific url within a subdirectory (for registration), and then prevent access to all other additional locations that follow that location stanza.

For example, I have the following configuration:

    <Location /foo>
        ProxyPass http://localhost:8080/foo retry=5 connectiontimeout=60 timeout=60
        Order deny,allow
        Allow from all
        <RequireAny>
            Require ip 66.66.66.66
        </RequireAny>
    </Location>

    <Location /foo/register.htm>
        ProxyPass http://localhost:8080/foo/register.htm retry=5 connectiontimeout=60 timeout=60
        Order deny,allow
        Allow from all
    </Location>

I'd like anyone on the web to be able to hit the http://localhost:8080/foo/register.htm location, but prevent access to any additional location within the /foo directory that isn't coming from the 66.66.66.66 ip address.

Some of the things I've tried include changing the position of the <Location /foo/register.htm> stanza (I've read you have to put it before the <Location /foo> stanza because of the ProxyPass), and I've played with REGEX entries <Location /foo^/(?!register.htm)>, but the damn <Location /foo> seems to always take precedence over the <Location /foo/register.htm> stanza and prevent access.

Any help will seriously be very appreciated. Thank you!

0

There are 0 best solutions below