You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tony Collen <tc...@neuagency.com> on 2003/03/31 23:30:19 UTC

mod_proxy & remote_addr

Hi everybody,

I got into a discussion with somebody today about the use of mod_proxy
with Apache 2 and [Tomcat|Jetty]/Cocoon.  The discussion was about how
mod_proxy passes the x-forwarded-for header which contains the "real"
remote address of the client, because to the servlet container, the remote
address just appears as the machine that Apache is on.

Anyway, we were talking about easy ways to work around this, mostly if
some application was designed to use REMOTE_ADDR.  (Using mod_proxy would
obviously break this).  If the application's code had tons of references
directly to REMOTE_ADDR, then if the app was deployed behind mod_proxy,
lots of bad things would happen.

So I go tot thinking about how I would overcome this in Cocoon, and the
following came to mind (which unfortunately doesn't work.. see
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=104222552707316&w=2 ):

<map:component-configurations>
    <global-variables>

    <!--+
        | uncomment the following line if we're using mod_proxy and need the proxied remote_addr
        |
        | <remote_addr>{request-header:x-forwarded-for}</remote_addr>
        |
        +-->

    <!--+
        | otherwise, we just want to use the "regular" remote_addr variable (default)
        +-->
        <remote_addr>{request:remoteAddr}</remote_addr>
    </global-variables>
</map:component-configurations>

This solution would provide a very painless, easy-to-change way to change
how Cocoon would see the remote host.  According to the thread above, this
doesn't work (and I've tested it myelf, much to my failure).

Can anyone think of a good way to configure this sort of thing without
having to change tons of lines of code in one go?


Regards,

Tony



--
Tony Collen
ICQ: 12410567 IRC: irc.byxnet.net
--
Cocoon: Internet Glue (A Cocoon Weblog)
http://manero.otrg/weblog/
--


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