Forum Discussion
Justin_Haggerty
Nimbostratus
Jun 14, 2007rewrite issue
Say our app behind our bigip answers up to www.xyz.com from the web. the server behind the bigip's hostname is actually www.abc.com. My current setup is working except for instances when people browse to say www.xyz.com/admin/ there browser then tries to load www.abc.com/admin/index.html. This eventually times out as www.abc.com isn't open to the world. What I'm looking to do is get that redirect to go to www.xyz.com/admin/index.html.
I wrote the following irule, but it doesn't seem to be working. They still get sent to abc.com.
when HTTP_REQUEST {
if { [HTTP::host] contains "abc.com" } {
HTTP::redirect "https://www.xyz.com/[HTTP::uri]"
}
}
Any help would be greatly appreciated.
- Deb_Allen_18Historic F5 Account(moved your post to the proper forum)
- Justin_Haggerty
Nimbostratus
the problem i'm seeing is when some one doesn't specify the actual file name. like /admin instead of /admin/index.html. apache knows to look for index.html in the directory and redirect to that page. But it is redirecting to the wrong hostname. They're getting sent to abc.com/admin/index.html, they requested xyz.com/admin/. - What's happening is that the backend webserver is sending a 301 or 302 based redirect to the browser. The redirect is in the HTTP response header named Location. For your situation, all you'll need to do is catch 301 or 302 responses in the Response and replace abc.com with xyz.com in the response value. Something like this should work for you.
when HTTP_RESPONSE { switch [HTTP::status] { 301 - 302 { HTTP::header Location [string map {abc.com xyz.com} [HTTP::header Location]] } } }
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