httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raphaƫl D <>
Subject [users@httpd] graphing Apache directives order
Date Fri, 20 Nov 2015 02:23:51 GMT

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!

View raw message