How to get remote IP for Http acceptor

Posted by smahanta on 26-Nov-2009 11:34

I have a sonic service listening to an Http acceptor.An http client sends http get/post request to that http acceptor.I want to find out what is the IP of the http client.How to do that? If it were a servlet we could have called  ServletRequest.getRemoteHost on the request object.Please help.

----Subhendu

All Replies

Posted by Bill Wood on 28-Nov-2009 07:42

Check the Message Headers.... there may be one that has this information.  The Sonic broker (on receiving inbound requests over http) copies all the HTTP headers into the message.  You are correct that, as a JMS client, you don't have access to the servlet context, but typically this information is often available in the headers.  Of note, is that not all HTTP headers are propogated.

From Progress SonicMQ Deployment Guide V7.6, Chapter 19: HTTP(S) Direct Acceptors and Routings, page 460

Discardable HTTP Properties

All nonstandard HTTP header properties are copied directly to the JMS message as
custom properties. However, the following standard properties of an HTTP message are
not preserved in JMS messages:

            Accept                         Accept-Charset             Accept-Encoding
            Accept-Language          Allow                            Authorization
            Cache-Control               Connection                   Cookie
            Cookie2                        Date                             Expect
            From                            Host                             If-Match
            If-Modified-Since           If-None-Match               If-Range
            If-Unmodified-Since       Max-Forwards               Pragma
            Proxy-Authorization       Range                           Referer
            TE                                Trailer                           Transfer-Encoding
            Upgrade                       User-Agent                    Warning

           

Posted by Admin on 23-Jan-2010 12:41

AFAIK you cann not get it within acceptor. But when you pick up the message coming through the acceptor, you will have all the MIME headers that the HTTP message has as JMS headers. So, basically check the X-* JMS headers of the message.

When coming through the proxy, X-Forwarded-For is your header.

But, just take a look at the JMS headers and most probably you find what you need.

This thread is closed