Forum Discussion
Irules with parameter values in target url
HI,
So First of you have to create a DataGroup (Local Trafic -> DataGroup -> List then create). Select String Type:
Name: DG_parameters
String: mysite.second.com
Value: PartnerIdpId=http://team02.com
Then create this irule and add it to your VS.
when HTTP_REQUEST {
Set hostname in the user request
set hostname [string tolower [HTTP::host]]
set uri [HTTP::uri]
Check if this hostname exist in the DG
if { [class match $hostname contains DG_parameters] } {
The hostname exist so we will retrieve the value, so th parameters
set parameters_DG [class match -value $hostname contains DG_parameters]
So now we will modify user request by adding the parameters
HTTP::uri $uri$parameters_DG
}
}
As you can noticed in my irule, I added parameters in all request. You can add additional condition that allow you to send parameters with specific hostname + uri.
If you want to send the parameter only for specific URI and Hostname follow the following procedure
So First of you have to create a DataGroup (Local Trafic -> DataGroup -> List then create). Select String Type:
Name: DG_parameters
String: mysite.second.com/variable (as you can noticed in the string we added hostname and URI)
Value: PartnerIdpId=http://team02.com
And create this irule...
when HTTP_REQUEST {
Set hostname in the user request
set hostname [string tolower [HTTP::host]]
set uri [HTTP::uri]
set url "$hostname$uri"
Check if this hostname exist in the DG
if { [class match $url contains DG_parameters] } {
The hostname exist so we will retrieve the value, so th parameters
set parameters_DG [class match -value $url contains DG_parameters]
So now we will modify user request by adding the parameters
HTTP::uri $uri$parameters_DG
}
}
I did not test the irule and it will also optimize it by changing the contains by equal ... but step by step 🙂
Keep me in touch.
Regards
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