Forum Discussion
Muhannad
Jul 15, 2020Cirrus
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...
- 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.
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.
Muhannad
Jul 19, 2020Cirrus
Dear Dario,
This worked as charm, many thanks :).
Regards,
Muhannad
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects