You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Bud P. Bruegger" <bu...@comune.grosseto.it> on 2005/04/21 16:41:52 UTC
Re: [users@httpd] SetEnv using values of other environment
variables?
> > In order to leave intact the application on the backup server, could we use
> > a setenv mechanism on the backend server, in order to rewrite the
> > remote_addr variable with the x_forwarded_for variable ?
>
>No. This would require a custom apache module. (It probably wouldn't
>be too complicated, but you would need to be very careful about
>security issues.)
>
>Joshua.
hmm. I'm working on a very related issue, trying to use SetEnv to copy
the value of one environment variable (set via the header of the HTTP
request) to another. Kind of
SetEnv NEW_VAR %{HTTP_SOME_HEADER_FIELD}e
You say above that this requires writing a custom module and earlier
inquiries on the same issue, it seems haven't come up with answers either (see
http://mail-archives.apache.org/mod_mbox/httpd-users/200403.mbox/%3cF71DE20E4813974B87772D7DDACE8E510F7AB5@EMEXM1107.dir.svc.accenture.com%3e
I'm new to writing modules and was wondering whether you could give me some
general direction (keywords, similar examples) to get me started. Maybe
Mod-Python would be the easiest way to get something working fast?
many thanks in advance
-bud
>---------------------------------------------------------------------
>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
-------------------------------------------------------------------------------------------------
Ing. Bud P. Bruegger, Ph.D. +39-0564-488577
(voice), -21139 (fax)
Servizio Elaborazione Dati e-mail: bud@comune.grosseto.it
Comune di
Grosseto http://www.comune.grosseto.it/cie/
Via Ginori,
43 http://OpenPortalGuard.sf.net
58100 Grosseto (Tuscany, Italy) jabber: bud@amessage.info
Free Software in Public Administration: not just a good idea, but a necessity
Perfection is attained, not when there is nothing more to be added, but
when there is nothing more to be taken away -- Antoine de Saint-Exupery
---------------------------------------------------------------------
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] SetEnv using values of other environment
variables?
Posted by "Bud P. Bruegger" <bu...@comune.grosseto.it>.
>>hmm. I'm working on a very related issue, trying to use SetEnv to
>>copy the value of one environment variable (set via the header of the
>>HTTP request) to another. Kind of
>>
>>SetEnv NEW_VAR %{HTTP_SOME_HEADER_FIELD}e
>[...]
>I don't think Joshua's statement about needing to write a new module
>applies to your situation. There is a big difference between changing
>the value if the REMOTE_ADDR environment variable, which is set by the
>TCP connection, and grabbing the value of an HTTP header and setting it
>as a new env var for downstream use.
>
>You may need to use a mod_rewrite call to "grab" the value of your HTTP
>request header, if it's not one of the standard ones, but I would
>probably use mod_rewrite anyway, since I've never really had good luck
>with SetEnv (or SetEnvIf).
>
>Give this a try:
>
>RewriteEngine On
>RewriteCond %{HTTP:HTTP_SOME_HEADER_FIELD} (.*)
>RewriteRule .* - [E=New_VAR:%1]
>
>-Brian
Cool! This just works!
many thanks!
-b
>---------------------------------------------------------------------
>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
-------------------------------------------------------------------------------------------------
Ing. Bud P. Bruegger, Ph.D. +39-0564-488577
(voice), -21139 (fax)
Servizio Elaborazione Dati e-mail: bud@comune.grosseto.it
Comune di
Grosseto http://www.comune.grosseto.it/cie/
Via Ginori,
43 http://OpenPortalGuard.sf.net
58100 Grosseto (Tuscany, Italy) jabber: bud@amessage.info
Free Software in Public Administration: not just a good idea, but a necessity
Perfection is attained, not when there is nothing more to be added, but
when there is nothing more to be taken away -- Antoine de Saint-Exupery
---------------------------------------------------------------------
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] SetEnv using values of other environment variables?
Posted by Brian Hughes '89 <br...@Alum.Dartmouth.ORG>.
On Apr 21, 2005, at 10:41 AM, Bud P. Bruegger wrote:
>> > In order to leave intact the application on the backup server,
>> could we use
>> > a setenv mechanism on the backend server, in order to rewrite the
>> > remote_addr variable with the x_forwarded_for variable ?
>>
>> No. This would require a custom apache module. (It probably wouldn't
>> be too complicated, but you would need to be very careful about
>> security issues.)
>>
>> Joshua.
>
> hmm. I'm working on a very related issue, trying to use SetEnv to
> copy the value of one environment variable (set via the header of the
> HTTP request) to another. Kind of
>
> SetEnv NEW_VAR %{HTTP_SOME_HEADER_FIELD}e
>
> You say above that this requires writing a custom module and earlier
> inquiries on the same issue, it seems haven't come up with answers
> either (see
> http://mail-archives.apache.org/mod_mbox/httpd-users/200403.mbox/
> %3cF71DE20E4813974B87772D7DDACE8E510F7AB5@EMEXM1107.dir.svc.accenture.c
> om%3e
I don't think Joshua's statement about needing to write a new module
applies to your situation. There is a big difference between changing
the value if the REMOTE_ADDR environment variable, which is set by the
TCP connection, and grabbing the value of an HTTP header and setting it
as a new env var for downstream use.
You may need to use a mod_rewrite call to "grab" the value of your HTTP
request header, if it's not one of the standard ones, but I would
probably use mod_rewrite anyway, since I've never really had good luck
with SetEnv (or SetEnvIf).
Give this a try:
RewriteEngine On
RewriteCond %{HTTP:HTTP_SOME_HEADER_FIELD} (.*)
RewriteRule .* - [E=New_VAR:%1]
-Brian
---------------------------------------------------------------------
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