Forum Discussion
Andrew-F5
Jul 08, 2019Employee
Dudi,
Your server is likely sending app-server.ashdod.eu in a location header on response so the browser then requests 'app-server.ashdod.eu/path/'.
You will need to rewrite the host on both client and server side requests/responses.
Client request: FrontEnd.ashdod.muni.com > (F5) change FrontEnd.ashdod.muni.com to app-server.ashdod.eu > Send to server
Server response: app-server.ashdod.eu > (F5) change app-server.ashdod.eu to FrontEnd.ashdod.muni.com > send to response to client.
Refer to https://devcentral.f5.com/s/feed/0D51T00006i7Vu6SAE, @frisco76 104868 for credit.
when RULE_INIT {
set ::external_hostname "FrontEnd.ashdod.muni.com"
set ::internal_hostname "app-server.ashdod.eu"
Enable debug logging to /var/log/ltm. 1 = yes, 0 = no
set ::hostname_rewrite_debug 0
}
when HTTP_REQUEST {
if {$::hostname_rewrite_debug}{log local0. "Original URL: [HTTP::host][HTTP::uri]"}
HTTP::header replace "Host" $::internal_hostname
if {$::hostname_rewrite_debug}{log local0. "New URL: [HTTP::host][HTTP::uri]"}
}
when HTTP_RESPONSE {
if { [HTTP::header value "Location"] starts_with "$::internal_hostname" }{
if {$::hostname_rewrite_debug}{log local0. "Inside of HTTP::header location, orig HTTP location equals: [HTTP::header location]"}
set ::location [HTTP::header location]
HTTP::header replace location $::external_hostname
if {$::hostname_rewrite_debug}{log local0. "Inside of HTTP::header location, new HTTP location equals: [HTTP::header location]"}
}
}