I am using a LocationMatch directive to determine whether or not to set CORS headers, but I'm having trouble getting it working properly.
For example, if the URI is /folder1/f/folder2/document1
, then <LocationMatch "^/folder1/f">
works, but <LocationMatch "^/folder1/f/">
does not, however <LocationMatch "^/folder1/f.">
does. Ideally I would end up with <LocationMatch "^/folder1/f/folder2">
, but that doesn't work either.
I can't figure out why ^/folder1/f/
doesn't work. Ideally I want to see in a log somewhere what it's matching against, in case there's something happening that I'm not aware of.
Is there any way to have that output to a log somewhere?
I found a way to do it, which I think is correct.
In the apache2 virtualhost, before the
<LocationMatch ...
line, I put(The
s
is required because I am in an SSL context)When I load the page I can then look at the headers and I discovered that a
rewrite
rule was rewriting the URL and the LocationMatch was working on the rewritten URL, not the original. Because the rewritten URL matches the first part of the URL it was matching up until the point where it rewrites.