Forum Discussion
Viversector_326
Nimbostratus
Jul 05, 2017Remove port number from URL
Hello,
I have a VIP running on port 443 which connects to our back end web servers running port 80. I have the following irule setup to change URLs from http to https. The problem I have is some...
Stanislas_Piro2
Cumulonimbus
Jul 06, 2017Hi,
you can try this code:
when HTTP_REQUEST {
STREAM::disable
if { [HTTP::header exists "Accept-Encoding"] } {
HTTP::header remove "Accept-Encoding"
}
set host [HTTP::host]
}
when HTTP_REQUEST_RELEASE {
if {![info exists streamfilter]} {
this part create the stream filter to convert absolute URL to relative URL if it is on the same web service.
Must be done in client side (event HTTP_REQUEST_RELEASE) to get the pool member port number.
set port [TCP::remote_port]
set streamfilter [list "@http://${host}/@/@ @http://${host}:${port}/@/@"]
}
}
when HTTP_RESPONSE {
if { [HTTP::header exists "Location"] } {
if { [set Location [HTTP::header Location]] starts_with "http://"} {HTTP::header replace Location [string map $streamfilter $Location]}
}
if {[HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "xml" } {
apply stream filter
STREAM::expression $streamfilter
Enable the stream filter for this response only
STREAM::enable
}
}Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects