You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by David Salisbury <sa...@globe.gov> on 2006/01/12 22:28:09 UTC
[users@httpd] Conf file macros?
Just wondering ( I don't see it in the docs ) if one can define "variables" in the Apache conf. files.
i.e. I have seen people write something along the lines of
%{HTTP_REFERER}
in their conf file.
So.. is there any support for a sort of variable substitution within the conf file.. e.g.
%DIR=/usr/local/
and then
ServerRoot %{DIR}
I'm doubting it but this would be nice.
-Dave
----- Original Message -----
From: "Axel-Stéphane SMORGRAV" <Ax...@europe.adp.com>
To: <us...@httpd.apache.org>
Sent: Thursday, January 12, 2006 7:36 AM
Subject: RE: [users@httpd] Apache reverse and caching proxy
How does this work for you: it depends on what you want.
If you want certain URLs to be revalidated with every request, you should follow Joshua's advice and make sure that those resources
are served with Cache-Control: must-revalidate. If the source server is an Apache and the resources are static files, you can
probably use mod_headers (Header set or Header append) to achieve this. The downside of this strategy is that it makes caching the
resource on the reverse proxy more or less pointless.
If you can accept a certain delay between the time where the source is updated and the update becomes effective for the client,
playing with CacheDefaultExpires may get you there. The RP cache will be revalidated every time the cache entry becomes stale, and
you can determine the interval using CacheDefaultExpires. That will reduce the number of requests that need to be forwarded all the
way to the source.
BR
-ascs
________________________________
From: Wim.Van.Leuven@ldc.be [mailto:Wim.Van.Leuven@ldc.be]
Sent: Thursday, January 12, 2006 3:27 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Apache reverse and caching proxy
Hello Axel-Stéphane,
If I can follow what you are trying to tell me, I should add the "expiresactive on" directive on the source server instead of the
caching server?
Axel-Stéphane SMORGRAV <Ax...@europe.adp.com>
12/01/2006 15:12
Please respond to
users@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Conf file macros?
Posted by Joshua Slive <jo...@slive.ca>.
On 1/12/06, httpd2@karsites.net <ht...@karsites.net> wrote:
>
> The module module_env is used to define variables in the
> config file, or pass variables from the shell to the apache
> environment.
>
> # define the environment variable
> SetEnv SrvRoot /usr/local/apache2
>
> I'm not sure of the syntax to use the variable though.
> As you say the docs are a bit vague to say the least!
See:
http://httpd.apache.org/docs/2.2/env.html
I believe you can actually use env variables (set outside apache) in
the config files using a syntax like ${var}, although it is
undocumented. You are better off pre-processing your config file with
m4 or something similar or using a third-party module like mod_macro.
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Conf file macros?
Posted by ht...@karsites.net.
The module module_env is used to define variables in the
config file, or pass variables from the shell to the apache
environment.
# define the environment variable
SetEnv SrvRoot /usr/local/apache2
I'm not sure of the syntax to use the variable though.
As you say the docs are a bit vague to say the least!
Regards - Keith
On Thu, 12 Jan 2006, David Salisbury wrote:
> To: users@httpd.apache.org
> From: David Salisbury <sa...@globe.gov>
> Subject: [users@httpd] Conf file macros?
>
>
> Just wondering ( I don't see it in the docs ) if one can define
> "variables" in the Apache conf. files.
>
> i.e. I have seen people write something along the lines of
>
> %{HTTP_REFERER}
>
> in their conf file.
>
> So.. is there any support for a sort of variable substitution within the
> conf file.. e.g.
>
> %DIR=/usr/local/
>
> and then
>
> ServerRoot %{DIR}
>
> I'm doubting it but this would be nice.
>
> -Dave
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Conf file macros?
Posted by David Salisbury <sa...@globe.gov>.
Thanks , one and all!
-Dave
----- Original Message -----
From: "Nick Kew" <ni...@webthing.com>
To: <us...@httpd.apache.org>
Sent: Thursday, January 12, 2006 6:31 PM
Subject: Re: [users@httpd] Conf file macros?
> On Thursday 12 January 2006 21:28, David Salisbury wrote:
>> Just wondering ( I don't see it in the docs ) if one can define "variables"
>> in the Apache conf. files.
>>
>> i.e. I have seen people write something along the lines of
>>
>> %{HTTP_REFERER}
>>
>> in their conf file.
>>
>> So.. is there any support for a sort of variable substitution within the
>> conf file.. e.g.
>>
>> %DIR=/usr/local/
>>
>> and then
>>
>> ServerRoot %{DIR}
>>
>> I'm doubting it but this would be nice.
>
> The answer is "no, but".
>
> There's no general support for that. But certain modules, such as
> mod_rewrite, support variables in some of their httpd.conf directives.
>
> You might want to look at the (third-party) mod_macro.
>
> --
> Nick Kew
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Conf file macros?
Posted by Nick Kew <ni...@webthing.com>.
On Thursday 12 January 2006 21:28, David Salisbury wrote:
> Just wondering ( I don't see it in the docs ) if one can define "variables"
> in the Apache conf. files.
>
> i.e. I have seen people write something along the lines of
>
> %{HTTP_REFERER}
>
> in their conf file.
>
> So.. is there any support for a sort of variable substitution within the
> conf file.. e.g.
>
> %DIR=/usr/local/
>
> and then
>
> ServerRoot %{DIR}
>
> I'm doubting it but this would be nice.
The answer is "no, but".
There's no general support for that. But certain modules, such as
mod_rewrite, support variables in some of their httpd.conf directives.
You might want to look at the (third-party) mod_macro.
--
Nick Kew
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org