Forum Discussion
VJ_96387
Nimbostratus
Mar 08, 2010URI Redirection
Hello all,
Need your help again!!!
I have a portal which has a multiple alias names and this is registered with external DNS servers. This portal can be accessed via internet.
The requests get hits the External VIP on the F5;. which has a 2 ISA servers in a pool. The ISA servers translate the request from .com to .corp, where the traffic is now passed to the internal f5 pair. (PS I use SNAT on the internal f5 pair)
I now need to redirect the request based on the original inputs to the pools based on the user input which inturn passes the traffic to the required portal.
My issue is that despite all the configs incl IRule, users are unable to access the portals.
THis is how it should work:
The users access the portal from internet using ped-a.abc.com or ped-b.abc.com... ped-d.abc.com; This traffic must be Translated to ped-a.abc.corp; ped-b.abc.corp...ped-d.abc.corp using IRULE on the internal f5 and ISA Servers.
I have done the necessary configs, but am unable to get this working. My setup is below. please help me to get this working.
Extenal VIP : 1.2.3.4
Pool: ISA_SERVERS
MEMBERS: 3.4.5.6:80 & 3.4.5.7 :80
Internal VIP:
ped-a.abc.corp : 10.10.10.10:80
pool: pool-Ped-a
MEMBERS: 192.168.1.100:54700
ped-b.abc.corp : 11.11.11.11:80
pool: pool-Ped-b
MEMBERS: 192.168.1.101:51100
ped-c.abc.corp : 12.12.12.12:80
pool: pool-Ped-c
MEMBERS: 192.168.1.200:51110
ped-d.abc.corp : 120.120.120.120:80
pool: pool-Ped-d
MEMBERS: 192.168.1.200:54700
IRULE (INTERNAL):
RULE NAME: ped_iRule
SHORT DESC: Redirects for ped portals
VERSION: 1.0
LONG DESC: Redirects for electronic ped portal.
when HTTP_REQUEST {
set H [HTTP::host]
set U [HTTP::uri]
if { ![regexp {.abc.corp$} $H] and ![regexp {.abc.com$} $H] } {
log "$H$U Redirect should be http://$H.abc.corp$U"
set H "$H.abc.corp"
}
if {[string equal "/" $U] and [string match "ped*.abc.corp" $H]}{
set U "/webdynpro/dispatcher/abc.com/pedwebform/pedWebForm"
}
HTTP::redirect "http://$H$U"
}
Awaiting your response.
6 Replies
- hoolio
Cirrostratus
Can you uncomment the log statements, retest and include details of what's not working?
It would also be more efficient to use string tests instead of using regexp to check the host header value. And you can use a switch to check the host header value:Check the requested host header set to lowercase switch -glob [string tolower [HTTP::host]] { "*.abc.corp" - "*.abc.com" { Do nothing as host ends with abc.corp or abc.com } default { Redirect client with abc.corp appended set host "[HTTP::host].abc.corp" } }
Aaron - L4L7_53191
Nimbostratus
I may be missing a requirement here, but on the surface something as simple as this may work for you:when HTTP_REQUEST { if { [HTTP::host] ends_with ".com"} { log local0. "redirecting to: [string map {.com .corp} [HTTP::host]][HTTP::uri]" HTTP::redirect http://[string map {.com .corp} [HTTP::host]][HTTP::uri] } }
Give this a try and see if it meets your needs.
-Matt - L4L7_53191
Nimbostratus
Wow, very nice trick hoolio - that pattern is akin to a 'pass' in python:if something: pass <<-- Like your first switch case above. If this matches, do nothing. Else, do something. An easy way to build exceptions like *.abc.corp, etc. else: do_something() <<-- Like your default case above.
Which is really useful and I've not thought about mocking it up in iRules like this until now. That switch pattern above is definitely going into the bag o' tricks, well done.
-Matt - VJ_96387
Nimbostratus
Aaron / Matt,
Thanks for your quick response. I will try n revert.
Aaron - assume you want do this on internal load balancer when HTTP_REQUEST {}
Please confirm.
Regards,
VJ - VJ_96387
Nimbostratus
I have another doubt, as I need two redirects
one from abc.com to abc.corp and then from
ped-a.abc.com -> ped-a.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
ped-b.abc.com -> ped-b.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
ped-c.abc.com -> ped-c.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
ped-d.abc.com -> ped-d.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
Please advise.
TIA.
VJ - VJ_96387
Nimbostratus
I have another doubt, as I need two redirects
one from abc.com to abc.corp and then from
ped-a.abc.com -> ped-a.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
ped-b.abc.com -> ped-b.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
ped-c.abc.com -> ped-c.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
ped-d.abc.com -> ped-d.abc.corp/webdynpro/dispatcher/abc.com/pedigreewebform/PedigreeWebForm
Please advise.
TIA.
VJ
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
