A colleague of mine came up with the following, I’ve changed the hostnames/ports etc
It partially works but we are not sure if its fixing anything
Also if I remove the rewrite profile it fails
when HTTP_REQUEST {
# 1. SELECT THE POOL (Traffic Steering)
# Replace ‘/specific-path’ with your actual URI path (e.g., /portal)
if { [HTTP::uri] starts_with “/examples” } {
pool poolA
} else {
# Default all other traffic
pool poolB
}
# 2. FIX THE redirect_uri PARAMETER (The new fix)
# This searches the URI for the internal name/port and replaces it with the public one
if { [HTTP::uri] contains “redirect_uri” } {
set internal_1 “hosta:20000”
set internal_2 “hostb:2223”
set public “external.wideip.com”
# Rewrite the URI to swap internal info for public info
set new_uri [string map [list $internal_1 $public $internal_2 $public “http://” “https://”] [HTTP::uri]]
HTTP::uri $new_uri
}
# 3. Preparation for Stream Profile
HTTP::header remove “Accept-Encoding”
STREAM::disable
}
when HTTP_RESPONSE {
# 3. FIX THE URL BAR (Redirects)
if { [HTTP::is_redirect] } {
set loc [HTTP::header Location]
# Mapping all internal variations to your public HTTPS URL
set map_list {
“:20000” “”
“:2223” “”
“http://” “https://”
“hosta” “external.wideip.com”
“hostb” “external.wideip.com”
}
HTTP::header replace Location [string map $map_list $loc]
}
# 4. FIX THE PAGE CONTENT (Requires Stream Profile)
# Replaces internal names/ports found inside the HTML code
STREAM::expression “@hosta:20000@external.wideip.com@@hostb:2223@external.wideip.com”
STREAM::enable