Forum Discussion
Irule Suggestion
Irule Suggestion : dividing the URL based on the Country-Users and based on the official Language page:
-
Currently for every country, they have a separate extension alongwith the official Language page, but seems like http://outlet.XYZ.com/SEUILibrary/controller/e/ seems to be common.
-
We are having a common Virtual-server for the same in the BIGIP, lets say : 10.1.1.1 which is again mapped with a pool named as : Test-Pool having 4 active-servers where currently pages are hosted.
-
Example of the URL Pages based on country : US, IE, UK , DE , FR:
US:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_us/XYZPortal/en_US/special-offers.workflow:ShowPromo?LandingPage=/All/US/Portals/Outlet
IE:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_ie/XYZPortal/en_IE/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
UK:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_gb/XYZPortal/en_GB/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
DE:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_de/XYZPortal/de_DE/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
FR:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_fr/XYZPortal/fr_FR/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
Suggestion required:
Incase we can make some irule which will make use of Class-Maps( Data-Group) too to fulfil this, like : all these pages are behind same VIP:
a) If customer browse US site, it will redirect to US Page.
b) If customer browse UK site, it will redirect to UK Page.
c) If customer browse DE site, it will redirect to DE Page.
d) If customer browse FR site, it will redirect to FR Page.
e) If customer browse IE site, it will redirect to IE Page.
Thanks and Regards Parveez
13 Replies
- Kevin_Stewart
Employee
Can't say I completely understand the request. Let's say a user requests this:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_us/XYZPortal/en_US/special-offers.workflow:ShowPromo?LandingPage=/All/US/Portals/OutletDo you need this request to go to a specific pool member, or do you need to redirect to something (and if so, to what)?
- What_Lies_Bene1
Cirrostratus
How is the customer's country of origin identified please?
- Parveez_70209
Nimbostratus
To explain it more:--
1.User will hit main URL: outlet.lenovo.com and it will point to US customer's page and Language page is US English below:
http://outlet.lenovo.com/SEUILibrary/controller/e/outlet_us/LenovoPortal/en_US/special-offers.workflow:ShowPromo?LandingPage=/All/US/Portals/Outlet
- When user will hit MAIN url: outlet.ie.lenovo.com and it will point to IE customer's page and Language page is IE English below:
http://outlet.lenovo.com/SEUILibrary/controller/e/outlet_ie/LenovoPortal/en_IE/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
- When user will hit MAIN url: outlet.gb.lenovo.com and it will point to UK/GB customer's page and Language page is GB English below:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_gb/XYZPortal/en_GB/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
- When user will hit main URL: outlet.de.lenovo.com and it will point to UK/GB customer's page and Language page is DE below:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_de/XYZPortal/de_DE/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
- When user will hit main URL: outlet.fr.lenovo.com and it will point to FR customer's page and Language page is FR below:
http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_fr/XYZPortal/fr_FR/special-offers.workflow:ShowPromo?LandingPage=/All/EMEA/Portals/Outlet
But they all have a common Virtual-Server: lets say : 10.1.1.1 which is attached to a Test-Pool having 4 members where the pages are hosted.
Upon hitting the respective URL's by the customer, the expanded URL common part is: http://outlet.XYZ.com/SEUILibrary/controller/e/ , so can we write some irule making use of the Class-maps data-group to point it to the pool.
- What_Lies_Bene1
Cirrostratus
OK, that's clearer. Is a redirect OK?
- Parveez_70209
Nimbostratus
yes, US and IE URL is in production, others are not, those will come in production shortly.
- Vitaliy_Savrans
Nacreous
you can try something like this, also instead of redirect to node you can use redirect to pool:
when HTTP_REQUEST { if { [HTTP::uri] contains "outlet_us" } { node 192.168.1.1 80 } elseif { [HTTP::uri] contains "outlet_de" } { node 192.168.1.2 80 } } - Parveez_70209
Nimbostratus
No, our requirement seems a bit different:
Currently : outlet.lenovo.com , outlet.ie.lenovo.com ,outlet.de.lenovo.com, outlet.fr.lenovo.com, outlet.gb.lenovo.com is updated into DNS as VIP'S IP.
Instead of that now planning to have one VIP and we wanted to attach a Irule which will yes ofcourse mapped to the single pool: Test-Pool comprising of all 4 members.
But if you check the URL, once clicking on the main URL(outlet.lenovo.com , outlet.ie.lenovo.com ,outlet.de.lenovo.com, outlet.fr.lenovo.com, outlet.gb.lenovo.com) , the expanded URL will have common part as http://outlet.XYZ.com/SEUILibrary/controller/e/ , so can we write some irule making use of the Class-maps data-group.
Thanks and Regards Parveez
- What_Lies_Bene1
Cirrostratus
Here's my untested attempt, using two datagroups, one that maps en:en_gb etc. and another that maps en:EMEA;
when HTTP_REQUEST { Remove any port specification from the hostname and store the result in variable 'hostname' set hostname [getfield [HTTP::host] ":" 1] Extract the third element of the hostname (reading from the right) and store result in variable 'subhostname' set subhostname [getfield $hostname "." 3] Stop processing this rule if the variable 'subhostname' is empty if { $subhostname equals "" } { return } Check if the variable 'subhostname' matches our data group list, if not, stop processing this rule if { not [class match $subhostname equals "dg_name"] } { return } Now we're sure we have a valid value for 'subhostname' let's move on Extract the country URI element as necessary based on the 'subhostname' variable value set salescountry [class match -value -- $subhostname equals "dg_name"] Extract the region URI element as necessary based on the 'subhostname' variable value set salesregion [class match -value -- $subhostname equals "dg222_name"] Now finally do the redirect HTTP::redirect "[HTTP::host]/SEUILibrary/controller/e/outlet_$subhostname/XYZPortal/$salescountry/special-offers.workflow:ShowPromo?LandingPage=/All/$salesregion/Portals/Outlet" } - Parveez_70209
Nimbostratus
Hi,
Based on this suggestion: we got two data-groups::: dg_name and dg222_name. 1. So, in dg_name which part we will put. 2. and dg222_name which part we will put.
Taking an example of the below Five URLs:
outlet.lenovo.com , outlet.ie.lenovo.com ,outlet.de.lenovo.com, outlet.fr.lenovo.com, outlet.gb.lenovo.com
- set subhostname [getfield $hostname "." 3] ============= what this 3 here ?
Kindly guide.
Thanks and Regards Parveez
- Parveez_70209
Nimbostratus
Hi,
Based on this suggestion: we got two data-groups::: dg_name and dg222_name.
Query:
-
So, in dg_name which part we will put.
-
and dg222_name which part we will put.
-
set subhostname [getfield $hostname "." 3] ============= what this 3 here ?
Taking an example of the same Five main URLs:( which is a mixture of different zones)
outlet.lenovo.com( US) , outlet.ie.lenovo.com( EMEA ) ,outlet.de.lenovo.com( EMEA ), outlet.fr.lenovo.com( EMEA ), outlet.gb.lenovo.com( EMEA )
So, can we map all these together where you specifid Data-group: dg222_name for eg: en:EMEA
Kindly guide.
Thanks and Regards Parveez
-
- What_Lies_Bene1
Cirrostratus
OK, so the data group named dg_name will contain the hostname to language mappings;
gb:en_GB de:de_DE fr:fr_FRand so on. The dg222_name data group will contain the hostname to sales region mappings;
en:EMEA de:EMEA fr:EMEAThe 3 used with the getfield command specifies the value of the third field (as delimited by '.') from the right, so for outlet.ie.XYZ.com the value will be 'ie'.
I've just noticed that for US users only a three part hostname is used so we'll need to account for that too. If the only two regions are US and EMEA we can probable simplify the rule somewhat. Updated rule below;
when HTTP_REQUEST { Remove any port specification from the hostname and store the result in variable 'hostname' set hostname [getfield [HTTP::host] ":" 1] Extract the third element of the hostname (reading from the right) and store result in variable 'subhostname' set subhostname [getfield $hostname "." 3] Stop processing this rule if the variable 'subhostname' is empty if { $subhostname equals "" } { return } Check if the variable 'subhostname' matches our data group list, if not, redirect to the US site and stop processing this rule if { not [class match $subhostname equals "dg_name"] } { HTTP::redirect "http://outlet.XYZ.com/SEUILibrary/controller/e/outlet_us/XYZPortal/en_US/special-offers.workflow:ShowPromo?LandingPage=/All/US/Portals/Outlet" return } Now we're sure we have a valid value for 'subhostname' let's move on Extract the country URI element as necessary based on the 'subhostname' variable value set salescountry [class match -value -- $subhostname equals "dg_name"] Extract the region URI element as necessary based on the 'subhostname' variable value set salesregion [class match -value -- $subhostname equals "dg222_name"] Now finally do the redirect HTTP::redirect "[HTTP::host]/SEUILibrary/controller/e/outlet_$subhostname/XYZPortal/$salescountry/special-offers.workflow:ShowPromo?LandingPage=/All/$salesregion/Portals/Outlet" }
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