You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Raphaël D <ra...@gmail.com> on 2015/11/20 03:23:51 UTC

[users@httpd] graphing Apache directives order

Hi,

I'm trying to figure out what can affect Apache mod_cache and when
(= where should it be placed).


I made a graph (attachment) in an attempt to start writing that down,
but it's still (very) far from correct. Well, actually, I'm not even
sure that the best may to represent the issue.
(in green: directives  *setting* the "no-cache" environment variable
 in yellow: directives *using*   the "no-cache" environment variable)


I started from (so typical?) a use case where I wanted:

- to avoid cache based on raw URL:
> SetEnvIf Request_URI ^/content no-cache # <VirtualHost> context
- to avoid cache based on cookie:
> SetEnvIf Cookie /post/ no-cache 
- however, cache some even with cookies
> <If "%{REQUEST_URI} =~ /\.(js|css)$/"> UnsetEnv no-cache </If>
- but avoid caching some location completely, while in a <Location>
> <Location /admin> CacheDisable on </Location>
- but cache by default
> <Location /> CacheEnable disk </Location>
- taking into account that:
> FallbackResource /index.php # <Directory> context

With 3 contexts involving so many directives from various
modules, I'm obviously unable to get it right without a deep
documentation of the ordering and merging rules.


Anyway the "no-cache" variable is a nice example and environment seems
to be the one mean by which an admin can make modules communicates with
each other in Apache configuration.


The graph is based on the section-merge documentation
(<Directory>/.../<Location>/<If>) however Apache documentation clearly
states that merging policy is a module-specific thing.
Then how could a better graphic representation look like?



Actually, I found that even the combination of two simple things like:
> SetEnvIf Request_URI 
+
> RewriteRule . /foo
makes Request_URI matches /foo in every configurations I tried.


I also suffered the fact that URI argument given to CacheEnable
(CacheQuickHandler=off) is passed *after* FallbackResource is run.
(still unanswered) question about this sent here earlier this month.


It seems to imply that RewriteRule always precede <Location> too.
What I felt surprising since a FallbackResource inside a <Directory>
will affect a <Location>-based CacheEnable directive...


I expect many more "strange" things could beat hard unless the processing
order is made clear.



thank you!

[users@httpd] Re: graphing Apache directives order

Posted by Raphaël <ra...@gmail.com>.
Am I the only one such a (or similar) graphical representation would
highly help?
The begin with, any pointer to the documentation of the 10 most used
modules directives ordering and 10 most used directives processing order
would help.



On Thu, Nov 19, 2015 at 11:23:51PM -0300, Raphaël D wrote:
> Hi,
> 
> I'm trying to figure out what can affect Apache mod_cache and when
> (= where should it be placed).
> 
> 
> I made a graph (attachment) in an attempt to start writing that down,
> but it's still (very) far from correct. Well, actually, I'm not even
> sure that the best may to represent the issue.
> (in green: directives  *setting* the "no-cache" environment variable
>  in yellow: directives *using*   the "no-cache" environment variable)
> 
> 
> I started from (so typical?) a use case where I wanted:
> 
> - to avoid cache based on raw URL:
> > SetEnvIf Request_URI ^/content no-cache # <VirtualHost> context
> - to avoid cache based on cookie:
> > SetEnvIf Cookie /post/ no-cache 
> - however, cache some even with cookies
> > <If "%{REQUEST_URI} =~ /\.(js|css)$/"> UnsetEnv no-cache </If>
> - but avoid caching some location completely, while in a <Location>
> > <Location /admin> CacheDisable on </Location>
> - but cache by default
> > <Location /> CacheEnable disk </Location>
> - taking into account that:
> > FallbackResource /index.php # <Directory> context
> 
> With 3 contexts involving so many directives from various
> modules, I'm obviously unable to get it right without a deep
> documentation of the ordering and merging rules.
> 
> 
> Anyway the "no-cache" variable is a nice example and environment seems
> to be the one mean by which an admin can make modules communicates with
> each other in Apache configuration.
> 
> 
> The graph is based on the section-merge documentation
> (<Directory>/.../<Location>/<If>) however Apache documentation clearly
> states that merging policy is a module-specific thing.
> Then how could a better graphic representation look like?
> 
> 
> 
> Actually, I found that even the combination of two simple things like:
> > SetEnvIf Request_URI 
> +
> > RewriteRule . /foo
> makes Request_URI matches /foo in every configurations I tried.
> 
> 
> I also suffered the fact that URI argument given to CacheEnable
> (CacheQuickHandler=off) is passed *after* FallbackResource is run.
> (still unanswered) question about this sent here earlier this month.
> 
> 
> It seems to imply that RewriteRule always precede <Location> too.
> What I felt surprising since a FallbackResource inside a <Directory>
> will affect a <Location>-based CacheEnable directive...
> 
> 
> I expect many more "strange" things could beat hard unless the processing
> order is made clear.
> 
> 
> 
> thank you!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org