Forum Discussion
dionlbc_22838
Nimbostratus
Jan 18, 2012Host and URI rewrite
Hi All,
I'm stepping in to help with an F5 configuration while our person who is primarily responsible is out on maternity leave. I'm looking to do what seems to be a simple redirect of the hostname and URI.
I'm trying to redirect the following -
http://corporate.company.com/products/pwa
redirects to
http://project.company.com/products/pwa
I would like to keep any paths beyond /pwa in the URL when the redirection is made if possible.
Thanks for any and all help! :)
4 Replies
- hoolio
Cirrostratus
Hi,
If you want the client to see the project.company.com hostname, you can send them a 302 redirect with an iRule like this:when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "corporate.company.com"\ and [string tolower [HTTP::uri]] starts_with "/products/pwa"}{ HTTP::redirect "http://project.company.com[HTTP::uri]" } }
If you want to hide the project.company.com host name from the client you can use the ProxyPass iRule:
http://devcentral.f5.com/wiki/iRules.proxypassv10.ashx
Aaron - dionlbc_22838
Nimbostratus
Thank you Hoolio! This worked perfectly! - Ruddiger_79923
Nimbostratus
Hi there! I'm new to iRules and was wondering how I could do a similar thing but have it redirect all requests but keep the trailing path. ie:
http://corporate.company.com/Bananas redirects to:
http://development.company.com/Bananas
where Bananas could be any path at all. - Michael_Yates
Nimbostratus
Hi Ruddiger,
Just a minor modification to the solution that Hoolio posted would do what you are needing:when HTTP_REQUEST { if {[string tolower [HTTP::host]] eq "corporate.company.com" } { HTTP::redirect "http://development.company.com[HTTP::uri]" } }
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