Forum Discussion
Syntax to Map Virtual-Server's Character with Data-Group which Contains Pool Name
Kindly have a look into the below Irule:
1.Last part of the Data-Group: dg_parveez_dynamic_pools contains a list of all dynamic pools: 2.Idea is to apply/create a single Irule into the future and attact that into the new Virtual-Servers, and based on that we are planning to add the new dynamic pool into the Data-group created, to make operation task easy and error free. 3. Challenge is: When the user hit the Virtual-server, it should go to the correct Pool which will serve him the request, while matching the name.
when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }
when HTTP_REQUEST {
switch -glob [HTTP::uri] {
"/" {
log local0. "redirecting from /"
HTTP::redirect "http://http://www.lenovo.com/us/en"
return
pool pool_lenovo.com-http
}
"/iss_static*" {
pool $static_pool
return
}
default {
pool [class match -element [string tolower [virtual]] starts_with dg_parveez_dynamic_pools ]
return
}
}
}
- Example of the naming convention of the Virtual-Server and Pool mapped against it is:
a) Virtual-Server: apuat.leni2.com-VS-HTTP , Pool : pool_apuat_leni2.com_http b) Virtual-Server: apbuild.leni2.com-VS-HTTP , Pool : pool_apbuild.leni2.com_http c) Virtual-Server: apctdev.leni2.com-VS-HTTP , Pool : pool_apctdev.leni2.com_http
- Query: By comparing the above Irule, whether the below Irule part will fit our requirement, I mean can the Virtual-server will be intelligent enough to send the traffic to the correct dynamic pool to meet the requirement, or do we need to modify this:
Naming Convention of the Virtual-Server and Pool is mentioned into the Point 04:
default { pool [class match -element [string tolower [virtual]] starts_with dg_parveez_dynamic_pools ] return }
Kindly suggest.
Thanks and Regards Parveez
37 Replies
- Parveez_70209
Nimbostratus
Hi Kevin,
Thank you so much.
- So you suggested even we can keep the Data-Group same for both Static as well as Dynamic Pools, but in Irule still you specified both the Data-Groups created . Is that Typo error ?
2.So, we can just add like the below in one Data-Group , whether it matter while mapping if we map :
Virtal-sever:=StaticPool, Dynamic Pool
or
Virtal-sever:=Dynamic Pool,StaticPool
Will take impact our Irule format ?
Thanks and Rregards Parveez
- Kevin_Stewart
Employee
-
Yes a typo. You would have one data group.
-
You would need to stick with one order so that when you divide the values to create the list, the dynamic and static pools are always in the same list position.
-
- Parveez_70209
Nimbostratus
Hi Kevin,
Trying the same with Common Data-Group, but traffic is not going. Do we need to tweak something.
I tried creating String Data-Group where I put into:
String Option: Virtual-ServerName:=Static Pool, Dynamic Pool Value Nothing I put, Is that correct ?
Thanks and Regards Parveez
- Parveez_70209
Nimbostratus
ok Kevin now its coming, checking with Fiddler whether its all feature good or not.. Will keep you posted Sir.
- Parveez_70209
Nimbostratus
Hi Kevin,
We are creating two Virtual-Servers : One HTTP and other HTTPS:
So, in the below first part, whether it will be same for both ?
when HTTP_REQUEST { switch -glob [string tolower HTTP::uri]] { "/" { log local0. "redirecting from /" HTTP::redirect "http://www.parveez.com" return pool pool_parveez.com-http }
- Kevin_Stewart
Employee
The HTTP events and commands run at layer 7, AFTER SSL has been offloaded, so the iRules should be the same for both VIPs.
- Parveez_70209
Nimbostratus
Hi Kevin,
Big Problem :(
- I am trying this now with Data-Groups created Dynamic_POOL as well as Static Pool.
- created as test-paveez.com. But failing to browse http://test-parveez.com/.
-
But when browsing through the below( which is a part of Dunamic Page content, its opening and in fiddler seems like its going to right pages. http://test-parveez.com//SEUILibrary/controller/e/web/LenovoPortal/en_US/catalog.workflow:test-home
-
we simply need a 301 redirect, so that if http://www.parveez.com or https://www.lenovo.com/ are called, they redirect to http://www.parveez.com/us/en (this takes over for current functionality that exists in the siteselector application, as that application is expected to be removed). Learn subdomain irules will also be removed…
Thanks and Regards Parveez
- Kevin_Stewart
Employee
The above is probably not working because of the double forward slash between the host and the URI.
- Parveez_70209
Nimbostratus
I am using the below:
Using the below:
when CLIENT_ACCEPTED { set default_pool [LB::server pool]
Where Parveez_Dynamic1 is : test-parveez.com-HTTP:= pool_ctbuild.leni2.com_http
Thanks and Regards Parveez
- Parveez_70209
Nimbostratus
Sir,
The below is the original Irule which we are modifying:
HTTP Profilr IRULE:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }
when HTTP_REQUEST { set https_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$https_uri equals "/" } { HTTP::redirect "https://ctbuild.leni2.com/SEUILibrary/controller/e/web/LenovoPortal/en_US/catalog.workflow:test-home" pool pool_ctbuild.leni2.com_http
log local0. "redirected from /"
return } elseif { $https_uri starts_with "/iss_static" } {
log local0. "matched /iss_static"
pool pool_confarmct.leni2.com_http
log local0. "pool_confarmct.leni2.com_http defined, [LB::server pool] selected" return
} else {
log local0. "no match for rev. close connection" pool pool_ctbuild.leni2.com_http
}
}
And HTTPS Profile IRULE:
when CLIENT_ACCEPTED { set default_pool [LB::server pool] log local0. "Default pool [LB::server pool] set" log local0. "Client IP is [IP::remote_addr]" }
when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$http_uri equals "/" } { HTTP::redirect "http://ctbuild.leni2.com/SEUILibrary/controller/e/web/LenovoPortal/en_US/catalog.workflow:test-home" pool pool_ctbuild.leni2.com_http
log local0. "redirected from /"
return } elseif { $http_uri starts_with "/iss_static" } {
log local0. "matched /iss_static"
pool pool_confarmct.leni2.com_http
log local0. "pool_confarmct.leni2.com_http defined, [LB::server pool] selected" return
} else {
log local0. "no match for rev. close connection" pool pool_ctbuild.leni2.com_http
}
}
=======
Diving this into part:
Ist part:
when HTTP_REQUEST { set https_uri [string tolower [HTTP::uri]] log local0. "requested [HTTP::uri]" if {$https_uri equals "/" } { HTTP::redirect "https://ctbuild.leni2.com/SEUILibrary/controller/e/web/LenovoPortal/en_US/catalog.workflow:test-home" pool pool_ctbuild.leni2.com_http
this part we are modiying by: when HTTP_REQUEST { switch -glob [string tolower HTTP::uri]] { "/" { log local0. "redirecting from /" HTTP::redirect "http://www.parveez.com/us/en" return pool pool_www.parveez.com_http }
2nd part: is determined by elseif : is /iss_static part which is replaced by Data-Group: Parveez_Static1
and 3rd part is determined by : else which is replaced by Data-Group: Parveez_Dynamic1
Seems like Dynamic page contents are coming but all 404 errors( STATIC contents not coming) in fiddler when putting the static pool under the Data-Group. Thanks and Regards Parveez
- Kevin_Stewart
Employee
So which iRule version are you using?
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