For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Muhannad's avatar
Muhannad
Icon for Cirrus rankCirrus
Jul 15, 2020
Solved

rewrite the location in 302 response

Dear Experts,   I need a help to solve an issue related to SSL offloading with LTM, my issue as following: Client---LTM-VS---Server, the server is sending a HTTP redirect302 response to a locati...
  • Dario_Garrido's avatar
    Dario_Garrido
    Jul 16, 2020

    Hello Muhannad.

     

    Tried this code and it works like a charm.

    when HTTP_REQUEST {
    	set fqdn_name [HTTP::host]
    }
    when HTTP_RESPONSE {
    	set location [HTTP::header Location]
    	set port [URI::port $location]
    	set n_path [URI::path $location]
    	set n_basename [URI::basename $location]
    	set n_query [URI::query $location]
    	if { [HTTP::is_redirect] }{
    		if { $port eq 80 }{
    			HTTP::header replace Location "https://$fqdn_name$n_path$n_basename?$n_query"
    		}
    	}
    }

    Without iRule, this is the server response.

    < HTTP/1.0 302 Found
    < Location: http://example.local:80/xx/ApplicationsLogin?applicationId=MTA=&applicationInstanceId=MQ==
    < Server: BigIP
    < Connection: Keep-Alive
    < Content-Length: 0

    And this is the response with the iRule.

    < HTTP/1.0 302 Found
    < Location: https://example.local/xx/ApplicationsLogin?applicationId=MTA=&applicationInstanceId=MQ==
    < Server: BigIP
    < Connection: Keep-Alive
    < Content-Length: 0

    Regards,

    Dario.