Forum Discussion
LyonsG_85618
Cirrostratus
Mar 15, 2012Redirect IRULE
Looking for a bit of help please guys...
I am trying to write an IRULE that rewrites the host and uri but without doing a re-direct to clients browser.
when HTTP_REQUEST
if {[HTTP::host] equals "www.company.com" && [HTTP::uri] equals "/application"} {
HTTP::header replace Host "www.newcompany.com"
HTTP::uri /full/application/is/here
virtual VS_THIS_IS_WHERE_NEW_COMPANY_IS_CONFIGURED
}
}
The new virtual server where traffic is getting routed to does have client & server SSL profiles configured.
Both virtual servers (for old & new company) work fine.
I think I am missing something obvious but just can't see it.....
Thanks in advance for your help!
6 Replies
- nitass
Employee
i think you have to use pool command (to new company pool) instead of virtual command. - LyonsG_85618
Cirrostratus
Nitass....thanks for reply. I have tried pool command too.
Doing some further testing I have managed to get the syntax working on an internal BIG-IP.
The rules above is defined on BIG-IP's behind firewalls. I am now thinking (perhaps)
the firewall rules are not set correctly? - nitass
Employee
the firewall rules are not set correctly?i do not think so. i understand virtual command will send traffic to VS_THIS_IS_WHERE_NEW_COMPANY_IS_CONFIGURED internally (within bigip). so, firewall should not matter.
what i think is host header and uri might not be changed when sending to VS_THIS_IS_WHERE_NEW_COMPANY_IS_CONFIGURED. - nitass
Employee
sorry i am wrong.[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { log local0. "\[HTTP::host\]: [HTTP::host]" log local0. "\[HTTP::uri\]: [HTTP::uri]" HTTP::header replace Host "www.abc.com" HTTP::uri "/abc" virtual bar102 } } [root@ve1023:Active] config b virtual bar102 list virtual bar102 { snat automap pool foo102 destination 1.1.1.1:80 ip protocol 6 rules myrule102 profiles { http {} tcp {} } vlans none enable } [root@ve1023:Active] config b rule myrule102 list rule myrule102 { when HTTP_REQUEST { log local0. "\[HTTP::host\]: [HTTP::host]" log local0. "\[HTTP::uri\]: [HTTP::uri]" } } [root@ve1023:Active] config curl -I http://172.28.19.79 HTTP/1.1 404 Not Found Date: Thu, 15 Mar 2012 14:34:10 GMT Server: Apache/2.2.3 (CentOS) Content-Type: text/html; charset=iso-8859-1 [root@ve1023:Active] config cat /var/log/ltm Mar 15 07:40:03 local/tmm info tmm[4797]: Rule myrule : [HTTP::host]: 172.28.19.79 Mar 15 07:40:03 local/tmm info tmm[4797]: Rule myrule : [HTTP::uri]: / Mar 15 07:40:03 local/tmm info tmm[4797]: Rule myrule102 : [HTTP::host]: www.abc.com Mar 15 07:40:03 local/tmm info tmm[4797]: Rule myrule102 : [HTTP::uri]: /abc - what exactly is the issue now? i don't see what fails ...
how you tried with tcpdump to see where to traffic goes? - LyonsG_85618
Cirrostratus
Thanks for help.
Looks like the problem was that there was another IRULE on the virutal server.
I added "event disable all" to end of this IRULE and traffic is now hitting the other virtual server.
Many thanks
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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