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.
- hoolio
Cirrostratus
Can you uncomment the log statements, retest and include details of what's not working?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" } }
- 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] } }
- 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.
- VJ_96387
Nimbostratus
Aaron / Matt, - VJ_96387
Nimbostratus
I have another doubt, as I need two redirects - VJ_96387
Nimbostratus
I have another doubt, as I need two redirects
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