Bug 63145 - <FilesMatch> not work inside <If> <ElseIf> <Else>
Summary: <FilesMatch> not work inside <If> <ElseIf> <Else>
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4.37
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-05 14:27 UTC by roskoshinsky
Modified: 2019-02-17 16:32 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description roskoshinsky 2019-02-05 14:27:32 UTC
When I try to use <FilesMatch> inside <If> — the first one directive has not work.

<If "-f '/www/%{HTTP_HOST}/php70'">
   <FilesMatch \.php$>
      SetHandler "proxy:fcgi://127.0.0.1:9070"
   </FilesMatch>
</If>

This is working:

<If "-f '/www/%{HTTP_HOST}/php70'">
   Redirect / http://url/
</If>

and this one:

<FilesMatch \.php$>
   SetHandler "proxy:fcgi://127.0.0.1:9070"
</FilesMatch>
Comment 1 Luca Toscano 2019-02-17 16:32:05 UTC
Hi!

I verified this behavior, and I should be due to how sections are merged:

https://httpd.apache.org/docs/2.4/sections.html#merging

Files and FilesMatch are processed before the If blocks (in the map_to_storage core bits), so I think that when it comes to evaluate the <If> condition then the core will not be able to merge anything Files/Directory related, ending up in the result presented by your report.

Note that the following should work:

   <FilesMatch \.php$>
       <If "-f '/www/%{HTTP_HOST}/php70'">
          SetHandler "proxy:fcgi://127.0.0.1:9070"
       </If>
   </FilesMatch>

If my idea is true I am wondering if httpd should explicitly throw a configuration parse error when this kind of settings are applied by the user.