Forum Discussion
prasad_385282
Nimbostratus
Apr 30, 2019vip redirecting to pool member fqdn
I have a vip configured on port 80 and attached pool with a pool member listening on port 8000. when i do http;//vip fqdn then it is redirecting to pool member http;//poolmember fqdn on 8000
But...
youssef1
Cumulonimbus
May 01, 2019Hi, I so firs of try this irule:
replace:
- poolmember_fqdn1 by real hostname (fqdn) of your pool member
- poolmember_fqdn2 by real hostname (fqdn) of your pool member
Irule:
when HTTP_REQUEST {
save hostname for use in response
set vip_fqdn [HTTP::host]
}
when HTTP_RESPONSE {
Rewrite the Location header for redirects
if { [HTTP::header exists Location] }{
HTTP::header replace Location [string map {"http://poolmember_fqdn1:8010" "http://$vip_fqdn" "http://poolmember_fqdn2:8010" "http://$vip_fqdn"} [HTTP::header Location]]
}
}
Then if you backend app is developped with absolute link without Relativ you can use this irule:
when HTTP_REQUEST {
Disable the stream filter for requests
STREAM::disable
Remove this header to prevent server from compression response
HTTP::header remove Accept-Encoding
save hostname for use in response
set vip_fqdn [HTTP::host]
}
when HTTP_RESPONSE {
Rewrite the Location header for redirects
if { [HTTP::header exists Location] }{
HTTP::header replace Location [string map {"http://poolmember_fqdn1:8010" "http://$vip_fqdn" "http://poolmember_fqdn2:8010" "http://$vip_fqdn"} [HTTP::header Location]]
}
Rewrite the response content using a stream profile if it is text
if { [HTTP::header Content-Type] contains "text" } {
Set the stream expression with the find/replace strings
STREAM::expression "@poolmember_fqdn:8010@vip_fqdn@"
Enable the stream filter
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