Is Apache2 (HTTPD) Location tag a wildcard match?

apache, apache2

Solution

If you refer to the Apache docs, it clearly states that

Regular expressions can also be used, with the addition of the ~ character. For example:

`<Location ~ "/(extra|special)/data">`

would match URLs that contained the substring /extra/data or /special/data.

Problem

Good news is that I've already solved my problem, bad news is I don't understand the issue! ``` URL: http://host:port/a/b ``` httpd.conf ``` <Location /a> ProxyPass to Server.... </Location> <Location /b> ProxyPass to some other Server </Location> ``` In this setup, my request for `http://.../a/b` takes me to "some other server" instead of the expected "server" I was able to get my expected behavior by forcing more "regex-y" behavior, and using the starts with expression (aka: ``` <Location ~ "^/a"> ProxyPass to Server.... </Location> ``` If that's how I have to do it, that's fine. But the docs seemed rather unclear on this situation. Documentation Sources: The Httpd docs on the Location Tag http://httpd.apache.org/docs/2.0/mod/core.html#location seem to imply that Location matching in a non-regex manner (aka, no ~) does not use wildcards (that's why they have a section explaining how to use wildcards and regexs). Also the slash discussion at the end doesn't imply that it uses wildcards either. So, I'm left to assume that I've uncovered some bug in my version of Apache. Or maybe I just use too similar of URL structures and can't understand the Apache docs. Help me, StackOverflow!

Original source