Hi, On Mon, Apr 8, 2013 at 9:33 PM, martijn.list <[email protected]> wrote: > It looks like the implementation of ServletRequest#getServerName() fallsback > to using InetAddress#getLocalHost() if the Location header of the request > is not set. What I would like is to override what's being returned by > ServletRequest#getServerName() if the Location header is not set (i.e., > allow me to override the default return of the local IP address). I think > this is needed since a lot of Java web frameworks use > ServletRequest#getServerName() for generating a redirect URL. > > For example Tomcat allows you to set a proxyName parameter on the connector: > > "proxyName: If this Connector is being used in a proxy configuration, > configure this attribute to specify the server name to be returned for calls > to request.getServerName(). See Proxy Support for more information." > > http://tomcat.apache.org/tomcat-6.0-doc/config/http.html
For the record, this is now available out of the box in Jetty 9 using a HostHeaderCustomizer, see http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/jetty-server/src/main/java/org/eclipse/jetty/server/HostHeaderCustomizer.java. Will be in 9.0.4. -- Simone Bordet ---- http://cometd.org http://webtide.com http://intalio.com Developer advice, training, services and support from the Jetty & CometD experts. Intalio, the modern way to build business applications. _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
