Forum Discussion
help with Irule to change url from servername
Ok I finally have something that is workable.
when HTTP_REQUEST {
Disable the stream filter for all requests STREAM::disable
LTM does not uncompress response content, so if the server has compression enabled and it cannot be disabled on the server, we can prevent the server from sending a compressed response by removing the compression offerings from the client HTTP::header remove "Accept-Encoding"
}
when HTTP_REQUEST_SEND {
Need to force the host header replacement and HTTP:: commands into the clientside context as the HTTP_REQUEST_SEND event is in the serverside context clientside {
Look up the selected server IP in the datagroup to get the host header value
set host_header_value [class match -value [IP::server_addr] equals ip_to_hostdev_dg]
Check if the lookup returned a value
if {$host_header_value ne ""}{
Replace the host header value
HTTP::header replace Host "$host_header_value:[TCP::local_port]"
log local0. "[IP::client_addr]:[TCP::client_port]: Replaced Host header with $host_header_value:[TCP::local_port] to [LB::server]."
}
} }
when HTTP_RESPONSE { Check if server response is a redirect if { [HTTP::header is_redirect]} { Assuming server is including a port in hostname portion of redirect with 4 digits (i.e. hostname:7777) We are going to take the URI path and replace the hostname with our preferred name
log local0. "trimming [string trimleft [HTTP::header value Location] http:// ]"
set redirect_uri [findstr [string trimleft [HTTP::header value Location] http://] : 0]
HTTP::header replace Location https://csdev.abc.com$redirect_uri
} elseif {$host_header_value ne ""} {
Match an replace strings
STREAM::expression "@http://$host_header_value@https://csdev.abc.com.us@ @http%3A%2F%2F$host_header_value@https%3A%2F%2Fcsdev.abc.com@ @$host_header_value@csdev.abc.com@"
Enable the stream filter for this response only
STREAM::enable
}
}
I had to create 7 vips with the same ip going to the following ports 7777 8090 9001 9002 9003 9004 9005
Created a data group and stream profile and applied the irule to vip using port 7777 and 8090. Everything seems to be working well except for one thing and hopefully someone here can help.
Once the user is logged in and they want to run a report. The report comes up in another browser window (Pop-Up), that doesn't apparently follow the irule and replace the servername with the hostname. I ran HTTPwatch and it it looks like the pop is generated on port 9003.
How would I handle the pop-up window ?
If anyone wants to take a look at my http watch file let me know.
Thanks,
Shawn
Recent Discussions
Related Content
* 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