Forum Discussion
Pav_70755
Nimbostratus
Oct 26, 2010HTTP Re-Direct and keep original URL in address bar
I have the following simple re-direct in place
}
elseif { [HTTP::host] == "www.domain.com }{
HTTP::redirect "http://www.abc.com/subject"
I basically want the address bar to keep www.domain.com when displaying www.abc.com/subject
Any help much appreciated.
Thanks
Pav
- hoolio
Cirrostratus
Hi Pav, - Pav_70755
Nimbostratus
Thanks Aaron I have about 80 or do re-direct rules in that particular i-rule so I don't want to replace the host header for all of the re-directs just this one in particular? - hoolio
Cirrostratus
Is www.abc.com routable through LTM? Is it a server or pool that you can load balance to? Do you want to send requests which you don't rewrite to a different pool? - Pav_70755
Nimbostratus
Yep www.abc.com has just been set up with a dns entry to point to a virtual server on the LTM along with 80 or so other dns entries which require simple http re-directs. - Pav_70755
Nimbostratus
I've come across this [url=http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/afpg/2/aft/32977/aff/5/afv/topic/showtab/groupforums/Default.aspx]thread'>Click Herewhen HTTP_REQUEST priority 100 { set http_host [string tolower [string trim [getfield [HTTP::host] ":" 1]]] general URI redirecting switch $http_host { www.domain.com { HTTP::redirect http://www.abc.com/subject } "support.abc.com" { HTTP::redirect http://www.abc.com/subject } return } } }
- hoolio
Cirrostratus
Hi Pav,when HTTP_REQUEST { Check if requested host is domain.com or www.domain.com switch [string tolower [HTTP::host]] { "www.domain.com" - "domain.com" { Matched the hostname, so rewrite the host header HTTP::header replace Host "www.abc.com" Select different pool for this request? pool www.abc.com_http_pool } } }
- Pav_70755
Nimbostratus
Thanks Aaron when i tried that rule i got "Bad Request (Invalid Hostname) - hoolio
Cirrostratus
There are two likely causes of the invalid hostname error. Either the host header replacement is using the wrong value, or the request is going to the wrong pool. - Pav_70755
Nimbostratus
Hi Aaron, - hoolio
Cirrostratus
Hi Pav,
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