Forum Discussion
Irule to URL rewriting
How would you write an irule? A domain name "A" ip address points to F5. I would like keep the name of domain on the browser but under redirect internally with changing the URL on the Browser
12 Replies
- Arie
Altostratus
The
command does what you're looking for.HTTP::uri - Brad_Parker
Cirrus
If you're wanting to change ABC.com to Def.com server side but not redirect the clients browser you would use
when HTTP_REQUEST { HTTP::host "def.com" }- Arie
Altostratus
HTTP::host only works in 11.5+, though.
- Brad_Parker_139
Nacreous
If you're wanting to change ABC.com to Def.com server side but not redirect the clients browser you would use
when HTTP_REQUEST { HTTP::host "def.com" }- Arie
Altostratus
HTTP::host only works in 11.5+, though.
- Arie
Altostratus
For older versions you can use HTTP::header to replace the host:
when HTTP_REQUEST { HTTP::header replace Host "www.domain2.com" } - wyuen_99269
Altostratus
Hi,
Just another question, how would you write a a domain A has to redirect to B but would like the domain header to be domain A.Thank you
- Arie
Altostratus
when HTTP_REQUEST { if { [string tolower [HTTP::host] equals "www.domainA.com" ] } { HTTP::respond 301 Location "http:://www.domainB.com[HTTP::uri]" } if { [string tolower [HTTP::host] equals "www.domainB.com" ] } { HTTP::header replace Host "www.domainA.com" } } - Arie
Altostratus
Version 11.5+:
when HTTP_REQUEST { if { [string tolower [HTTP::host] equals "www.domainA.com" ] } { HTTP::respond 301 Location "http:://www.domainB.com[HTTP::uri]" } if { [string tolower [HTTP::host] equals "www.domainB.com" ] } { HTTP::host "www.domainA.com" } } - wyuen_99269
Altostratus
This another request for something I looking for do :
How would write using IRULE for condition :
If Domain = "canextest.cfmws.com" and Path = "/payment" then
redirect to another URL internallyelso go the whatever URL was entered.
- Brad_Parker
Cirrus
when HTTP_REQUEST { if { [HTTP::host] equals "canextest.cfmws.com" && [HTTP::uri] starts_with "/payment" } { HTTP::redirect http://some.url.com } } - wyuen_99269
Altostratus
Hi,
I tested the script running under 11.2.1, it does not work. It does redirect to the site. Would it possible rewrite the procedure under 11.2.1. when HTTP_REQUEST { if { [string tolower [HTTP::host] equals "www.domainA.com" ] } { HTTP::respond 301 Location "http:://www.domainB.com[HTTP::uri]" } if { [string tolower [HTTP::host] equals "www.domainB.com" ] } { HTTP::host "www.domainA.com" }}
Thank you
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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