Need Irule for redirection for port translation
Hello team,
I am trying to configure one web service. Post configuration when i tried to access service using F5 VS, the requests redirected to the http host with automatically addition of service port 8080 which is backend webserver port.
e.g. i was trying to access web service using https://abc.com --> it got redirected to http://abc.com:8080
I am sure, F5 is not adding this port. This is happening due to hard coded port from application itself but application team member is not able to find it under application config. I am looking for an iRule which will help to redirect 'http://abc.com:8080' to https://abc.com again.
I tried several which are available on internet but somehow not working for me. Please help me here.
Hello Vikash,
Please try below iRule -
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] contains "abc.com" } {
pool abc-pool
}
HTTP::header remove Accept-Encoding
STREAM::disable
}
when HTTP_RESPONSE {
# Disable the stream filter for server responses
STREAM::disable
# Enable the stream filter for text responses only
if {[HTTP::header value Content-Type] contains "text"}{
# Replace 'old_text' with 'new_text'
STREAM::expression {@http://abc.com:8080/@https://abc.com/@}
# Enable the stream filter for this response only
STREAM::enable
}
}
Hope it works for you!
Mayur