Forum Discussion
MSK_222682
Feb 04, 2016Nimbostratus
URL redirection with retaining the original on browsers
Hi All,
I have a requirement whereby the user would try to access www.test.com but it needs to be redirected to www.test.abc.com, which is hosted in our environment.
Business doesn't want to publ...
Minn_62043
Feb 04, 2016Cirrostratus
Are trying to convert the links inside the HTTP response from www.abc.test.com to www.test.com again?
You can create a new stream profile to translate the domain names or use an iRule like this:
when HTTP_REQUEST {
set to_change 0
if { [HTTP::path] contains "/urltomonitor" } {
set to_change 1
}
STREAM::disable
}
when HTTP_RESPONSE {
if { $to_change == 1} {
set original "http://www.abc.test.com"
set replacement "http://www.test.com"
STREAM::expression "@$original@$replacement@"
STREAM::enable
}
}
You will need to modify the [HTTP::path] to match your url that contains redirection, and you still need to attach "stream" profile to your virtual server.
- MSK_222682Feb 04, 2016NimbostratusHi Minn, Thanks for your quick response. I shall test this iRule in test infra. But can you help me understand how this above iRule (the commands) in it would be interpreted by BIGIP as I'm new to BIGIP technology and iRule code. Also, whats the role of "stream" profile in this case. Thanks again, Sai
- Minn_62043Feb 04, 2016CirrostratusSo if a user is going to this url http://www.test.com/urltomonitor, and the page is redirecting the user to http://www.abc.test.com or if the page contains http://www.abc.test.com, iRule will replace that domain with http://www.test.com before sending the response to user, and user browser will never get to see www.abc.test.com.
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