Forum Discussion

mj16othman's avatar
mj16othman
Icon for Altostratus rankAltostratus
Oct 04, 2023

Client Browser URL manipulation

Dears 

 

I have a request. I hjave clients trying to access the  URL  "https://abc.com:7443" but i want to remove the :7443 from the URL after the backend server response to the request and the URL to look like this "https://abc.com"

 

Ive tried everything with an irule but its not working 

when HTTP_RESPONSE {


if {[HTTP::host] contains ":"}{

HTTP::redirect "https://[getfield [HTTP::host] ":" 1][HTTP::uri]"
}
}

  • Snl's avatar
    Snl
    Icon for Cirrostratus rankCirrostratus

    give a try

     

    when HTTP_REQUEST {
        HTTP::header remove Accept-Encoding
        STREAM::disable
    }
    when HTTP_RESPONSE {
        if { [HTTP::header exists Location] } {
            HTTP::header replace Location [string map -nocase {"abc.com:7443" "abc.com"} [HTTP::header Location]]
        }
    
        if { [HTTP::header Content-Type] contains "text" } {
            STREAM::expression {@abc.com:7443@abc.com@}
            STREAM::enable
        }
    }