Hi Asankha,

I agree with what you are saying about replacing the UA being the "right
thing" for most use cases. In this case, the app to which I'm forwarding
my requests has some conditional logic based on the UA in the request so
I do need to pass it through. I tried just setting a transport header
but I'm not having any results. I'll keep trying and see what I can do.
Failing that, is there any place in the process where I can inject some
custom code _after_ the transport headers have been set for the outgoing
request? Maybe in a Formatter?

Thanks,

--GKC

-----Original Message-----
From: Asankha Perera [mailto:[email protected]] On Behalf Of
Asankha C. Perera
Sent: Monday, September 21, 2009 9:20 AM
To: [email protected]
Subject: Re: Passing user agent to endpoint

Hi Greg
> I'm trying to write a proxy that passes the caller's HTTP user agent
> through to the target endpoint. Currently, the user agent is being
> removed from the incoming request and replaced with the Synapse user
> agent. Is it possible to prevent this behavior or explicitly set the
> user agent for the outgoing request? From what I can tell, the
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender#invoke method
calls
> removeUnwantedHeaders before it processes the outgoing request. This
is
> the method that explicitly removes the user agent.
>   
Hmm.. I think its right to replace the user agent, since to the backend
service that receives a request from Synapse, the user agent "is"
Synapse..  Do you think this is wrong?

However, if you set a custom user agent header as a Synapse transport
header during mediation, thats applied after the above method call and
it "may" work.. I cannot tell you for sure until you try it out, since
we do however hard code the user agent via a request handler. Best is to
give that a try as a workaround.. however I am free to consider
retaining the user agent header if there is a compelling reason - but so
far this is the first time I've heard this request from a user

cheers
asankha

-- 
Asankha C. Perera
AdroitLogic, http://adroitlogic.org

http://esbmagic.blogspot.com




Reply via email to