Bug 63146

Summary: Directive Define not work correct inside <If> <ElseIf> <Else>
Product: Apache httpd-2 Reporter: roskoshinsky
Component: DocumentationAssignee: HTTP Server Documentation List <docs>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 2.4.37   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.1   

Description roskoshinsky 2019-02-05 14:56:15 UTC
Define Directive not work correct inside <if> <ElseIf> <Else>. In this sample the sSection will be "section2", ie even if -d is equal "/www/section1/%{HTTP_HOST}/www". Always triggerd the last Define Directive from the list.

…
<If "-d '/www/section1/%{HTTP_HOST}/www'">
   Define sSection section1
</If>
<If "-d '/www/section2/%{HTTP_HOST}/www'">
   Define sSection section2
</If>

UseCanonicalName Off
VirtualDocumentRoot /www/${sSection}/%0/www

…

This example is equivalent to

…

Define sSection section1
Define sSection section2

UseCanonicalName Off
VirtualDocumentRoot /www/${sSection}/%0/www

…
Comment 1 Eric Covener 2019-02-05 15:00:17 UTC
The stanza below in the docs needs to be expanded.  Define's are fundamentally global, not per-request, so you can't use any of the request processing directives to set or unset them,.


Virtual Host scope and pitfalls
While this directive is supported in virtual host context, the changes it makes are visible to any later configuration directives, beyond any enclosing virtual host.
Comment 2 Reindl Harald 2019-02-24 07:40:24 UTC
that's hardly a documentation issue - httpd should reject such config as it does for alot of things with "not allowed here..."