eclipse-ee4j / jersey

Eclipse Jersey Project - Read our Wiki:
https://github.com/eclipse-ee4j/jersey/wiki
Other
690 stars 352 forks source link

X-Forwarded-* aware UriInfo.getBaseBuilder #2716

Open jerseyrobot opened 10 years ago

jerseyrobot commented 10 years ago

As far as I can see, UriInfo.getBaseBuilder() does not return a builder that is aware of headers like X-Forwarded-For or X-Forwarded-Proto. It would be great to be able to control this. It seems that the UriBuilder is created is container-specific - for instance, here it is created in a servlet context: https://github.com/jersey/jersey/blob/master/containers/jersey-servlet-core/src/main/java/org/glassfish/jersey/servlet/ServletContainer.java#L518 The headers are still the same in any context, though.

The benefit here is that this will prevent developers from having to manually handle this in their resources, making both developing and deploying Jersey applications easier.

Affected Versions

[2.7]

jerseyrobot commented 6 years ago
jerseyrobot commented 10 years ago

@glassfishrobot Commented Reported by vetler

jerseyrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JERSEY-2444

juanmbellini commented 5 years ago

Are there any news about this?

chkal commented 5 years ago

At least for the Servlet case my guess is that the builder works as expected as soon as you configure your container to return correct values for the various HttpServletRequest.get*() methods. For Tomcat this would require to set up RemoteIpValve for example. So I'm not sure if this is really a Jersey issue.