users@jersey.java.net

[Jersey] Re: UriInfo_at_getBaseUri() with a load balancer

From: Eric Stein <steine_at_locustec.com>
Date: Wed, 5 Mar 2014 17:47:11 +0000

Thanks, Gili. My guess is the same as yours. I just don't want to have to set up a load balancer to confirm or refute it.

I'm not sure how any of the UriInfo#getXXX() methods behave when there's a proxy or load balancer in the mix, and either I missed it or it's not in the docs.

Thanks,
Eric

-----Original Message-----
From: cowwoc [mailto:cowwoc_at_bbs.darktech.org]
Sent: Wednesday, March 05, 2014 12:39 PM
To: users_at_jersey.java.net
Subject: [Jersey] Re: UriInfo_at_getBaseUri() with a load balancer

I'm guessing this depends on the HOST header the client sends and whether anyone transforms it along the way. Meaning, in theory it would be the load-balancer address. That being said, this is a total guess.
I'm curious what the JAX-RS authors have to say on this topic.

Gili

On 05/03/2014 12:14 PM, Eric Stein wrote:
> Let's say I put a load balancer in front of my Jersey API server. So a client would call:
>
> http://mylb.example.com/api/resources/12
>
> which would push the call through to one of
>
> http://server1.example.com/api/resources/12
> or
> http://server2.example.com/api/resources/12
>
> When I call UriInfo#getBaseUri(), what will I see?
> http://mylb.example.com/
> or
> http://server1.example.com/
>
> Thanks,
> Eric
>
>