Forum Discussion
hooleylist
Aug 15, 2013Cirrostratus
Yes, I'd check for response content that refers to the webserver port. You can either modify the server config to reference itself with the public facing port or use an iRule to rewrite the response headers and/or payload from the server port to the public facing port.
Here's an example to rewrite the server port: https://devcentral.f5.com/wiki/iRules.RewriteHTTPRedirectPort.ashx
To rewrite the response payload, you can use a stream profile and STREAM::expression based iRule:
https://devcentral.f5.com/wiki/iRules.stream__expression.ashx
Combining those, you could try something like this:
when HTTP_REQUEST {
Save the requested host value
set host [string tolower [HTTP::host]]
If the HTTP host header is blank, use the VS IP address
If the VS IP is not routable for clients, hard code a routable IP
to replace [IP::local_addr]
if {$host eq ""}{set host [IP::local_addr]}
Disable the stream filter by default
STREAM::disable
}
when HTTP_RESPONSE {
Rewrite the Location header to remove the server port
if { [HTTP::is_redirect] && [string tolower [HTTP::header Location]] contains $host} {
HTTP::header replace Location [string map -nocase "$host:[TCP::remote_port] $host" [HTTP::header Location]]
}
Check if response type is text and host isn't null
if {[HTTP::header value Content-Type] contains "text" and $host ne ""}{
Replace $host:8888 with $host
STREAM::expression "@$host:[TCP::remote_port]@$host@"
Enable the stream filter for this response only
STREAM::enable
}
}