httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam <adam.v...@vestfarms.com.INVALID>
Subject [users@httpd] "Define" directive is ALWAYS parsed
Date Sun, 18 Sep 2016 15:52:27 GMT
Hello,
I'm working on a way of making specific content available only under
certain circumstances, and I believe the best way to go about this is
to use the "Define" directive, then do some stuff within "<IfDefine
...>" wrappers. The problem is, no matter what kind of conditional
stuff I put around the Define line, it is always parsed.
Example:
    <If "%{HTTP_USER_AGENT} =~ /curl/>
    	    Define myvar
    </If>
With the above, the "myvar" parameter will always be defined for every
request, regardless of user-agent. This will also work:
    <If "%{REMOTE_ADDR} == 'these.are.numbers'">
    	    Define myvar
    </If>
Very clearly that should never ever match, yet it does. Reading the
documentation seems to indicate that the Define directive should be
obeying the context it is being put in:
Documentation for "If" directive (https://httpd.apache.org/docs/2.4/mod
/core.html#if):
> Only directives that support the directory context can be used within
> this configuration section.
Documentation for "Define" directive (https://httpd.apache.org/docs/2.4
/mod/core.html#define):
> Context:	server config, virtual host, directory
Perhaps the only way I could get Define to only be applied
conditionally is by following the example of nesting it within <IfDefin
e...> wrappers. But if Define is otherwise always set globally and
unconditionally, then the <IfDefine...> directive seems superfluous.
Am I vastly misunderstanding the usage of this here?
Thanks for any assistance.
-Adam

Mime
View raw message