Package ca.uhn.fhir.rest.server
Class ApacheProxyAddressStrategy
- java.lang.Object
-
- ca.uhn.fhir.rest.server.IncomingRequestAddressStrategy
-
- ca.uhn.fhir.rest.server.ApacheProxyAddressStrategy
-
- All Implemented Interfaces:
IServerAddressStrategy
public class ApacheProxyAddressStrategy extends IncomingRequestAddressStrategy
Works like the normalIncomingRequestAddressStrategyunless there's an x-forwarded-host present, in which case that's used in place of the server's address.If the Apache Http Server
mod_proxyisn't configured to supplyx-forwarded-proto, the factory method that you use to create the address strategy will determine the default. Note thatmod_proxydoesn't set this by default, but it can be configured viaRequestHeader set X-Forwarded-Proto http(or https)If you want to set the protocol based on something other than the constructor argument, you should be able to do so by overriding
protocol.Note that while this strategy was designed to work with Apache Http Server, and has been tested against it, it should work with any proxy server that sets
x-forwarded-host- Author:
- Created by Bill de Beaubien on 3/30/2015.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedApacheProxyAddressStrategy(boolean theUseHttps)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringdetermineServerBase(javax.servlet.ServletContext theServletContext, javax.servlet.http.HttpServletRequest theRequest)Determine the server base for a given requeststatic ApacheProxyAddressStrategyforHttp()Static factory for instance usinghttp://static ApacheProxyAddressStrategyforHttps()Static factory for instance usinghttps://StringforwardedServerBase(javax.servlet.ServletContext theServletContext, javax.servlet.http.HttpServletRequest theRequest, String theForwardedHost)protected Stringprotocol(javax.servlet.http.HttpServletRequest theRequest)-
Methods inherited from class ca.uhn.fhir.rest.server.IncomingRequestAddressStrategy
determineServletContextPath, setServletPath
-
-
-
-
Constructor Detail
-
ApacheProxyAddressStrategy
protected ApacheProxyAddressStrategy(boolean theUseHttps)
-
-
Method Detail
-
determineServerBase
public String determineServerBase(javax.servlet.ServletContext theServletContext, javax.servlet.http.HttpServletRequest theRequest)
Description copied from interface:IServerAddressStrategyDetermine the server base for a given request- Specified by:
determineServerBasein interfaceIServerAddressStrategy- Overrides:
determineServerBasein classIncomingRequestAddressStrategy
-
forwardedServerBase
public String forwardedServerBase(javax.servlet.ServletContext theServletContext, javax.servlet.http.HttpServletRequest theRequest, String theForwardedHost)
-
forHttp
public static ApacheProxyAddressStrategy forHttp()
Static factory for instance usinghttp://
-
forHttps
public static ApacheProxyAddressStrategy forHttps()
Static factory for instance usinghttps://
-
-