@ Override public int getPort ( HttpServletRequest request ) { String portValue = request . getHeader ( X_FORWARED_PORT ) ; if ( portValue != null ) return Integer . parseInt ( portValue ) ; return super . getPort ( request ) ; }
When the X - Forwarded - Port header is present this method returns the value of that header . When the header is not present it delegates this call to the super class .