You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2009/01/11 13:53:06 UTC

t5: when running tomcat behind Apache

Hi,

When running Tomcat behind a Apache Http server using proxy/reverseproxy,
following code returns "127.0.0.1" always,
any solution to this? Thanks.	
	
	@Inject
   	private RequestGlobals requestGlobals;
   	void setupRender() {
       String remoteIP =
requestGlobals.getHTTPServletRequest().getRemoteAddr();
	}
-- 
View this message in context: http://www.nabble.com/t5%3A-when-running-tomcat-behind-Apache-tp21398829p21398829.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: t5: when running tomcat behind Apache

Posted by Massimo Lusetti <ml...@gmail.com>.
On Mon, Jan 12, 2009 at 8:53 AM, Howard Lewis Ship <hl...@gmail.com> wrote:

> Should Tapestry assume it is running behind Apache and correctly
> operate on those special headers?

By my point of view, not at all. There are plenty of installation
where tomcat/jetty/whatever is running as a direct front end as there
are plenty where apache is used.

As there's a way from Request to get the header that's fine for me.

-- 
Massimo
http://meridio.blogspot.com

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


Re: t5: when running tomcat behind Apache

Posted by Angelo Chen <an...@yahoo.com.hk>.
might be nice to have something like this in RequestGlobals:

  public String getRealRemoteAddr() {
        String ip =
requestGlobals.getHTTPServletRequest().getHeader("X-Forwarded-For");
        if (ip != null)
            return ip;
        else
            return requestGlobals.getHTTPServletRequest().getRemoteAddr();
    }

Howard Lewis Ship wrote:
> 
> Should Tapestry assume it is running behind Apache and correctly
> operate on those special headers?
> 
> On Sun, Jan 11, 2009 at 2:57 PM, Kevin Menard <ni...@gmail.com> wrote:
>> Hi Angelo,
>>
>> I think you need to take a look at the X-Forwarded-For header.  Please
>> see:
>>
>> http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers
>>
>> --
>> Kevin
>>
>>
>>
>> On Sun, Jan 11, 2009 at 7:53 AM, Angelo Chen <an...@yahoo.com.hk>
>> wrote:
>>>
>>> Hi,
>>>
>>> When running Tomcat behind a Apache Http server using
>>> proxy/reverseproxy,
>>> following code returns "127.0.0.1" always,
>>> any solution to this? Thanks.
>>>
>>>        @Inject
>>>        private RequestGlobals requestGlobals;
>>>        void setupRender() {
>>>       String remoteIP =
>>> requestGlobals.getHTTPServletRequest().getRemoteAddr();
>>>        }
>>> --
>>> View this message in context:
>>> http://www.nabble.com/t5%3A-when-running-tomcat-behind-Apache-tp21398829p21398829.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator Apache Tapestry and Apache HiveMind
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/t5%3A-when-running-tomcat-behind-Apache-tp21398829p21437220.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: t5: when running tomcat behind Apache

Posted by Howard Lewis Ship <hl...@gmail.com>.
Should Tapestry assume it is running behind Apache and correctly
operate on those special headers?

On Sun, Jan 11, 2009 at 2:57 PM, Kevin Menard <ni...@gmail.com> wrote:
> Hi Angelo,
>
> I think you need to take a look at the X-Forwarded-For header.  Please see:
>
> http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers
>
> --
> Kevin
>
>
>
> On Sun, Jan 11, 2009 at 7:53 AM, Angelo Chen <an...@yahoo.com.hk> wrote:
>>
>> Hi,
>>
>> When running Tomcat behind a Apache Http server using proxy/reverseproxy,
>> following code returns "127.0.0.1" always,
>> any solution to this? Thanks.
>>
>>        @Inject
>>        private RequestGlobals requestGlobals;
>>        void setupRender() {
>>       String remoteIP =
>> requestGlobals.getHTTPServletRequest().getRemoteAddr();
>>        }
>> --
>> View this message in context: http://www.nabble.com/t5%3A-when-running-tomcat-behind-Apache-tp21398829p21398829.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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


Re: t5: when running tomcat behind Apache

Posted by Kevin Menard <ni...@gmail.com>.
Hi Angelo,

I think you need to take a look at the X-Forwarded-For header.  Please see:

http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#x-headers

-- 
Kevin



On Sun, Jan 11, 2009 at 7:53 AM, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Hi,
>
> When running Tomcat behind a Apache Http server using proxy/reverseproxy,
> following code returns "127.0.0.1" always,
> any solution to this? Thanks.
>
>        @Inject
>        private RequestGlobals requestGlobals;
>        void setupRender() {
>       String remoteIP =
> requestGlobals.getHTTPServletRequest().getRemoteAddr();
>        }
> --
> View this message in context: http://www.nabble.com/t5%3A-when-running-tomcat-behind-Apache-tp21398829p21398829.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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