Forum Discussion
Irule that select pool memeber based on client language in http header
I am trying to make an irule that forwards traffic to a specific pool or pool member based on client language used in http header
- amr_magdy_25051
Nimbostratus
when HTTP_REQUEST { if { [HTTP::header "Accept-Language"] starts_with "en" } { pool test member 10.2.0.11 80 } }
- Snl
Cirrostratus
try below
when HTTP_REQUEST { if { [HTTP::header "Accepted-Language"] contains "en-us" } { pool Pool_english } }
- Kevin_Davies_40
Nacreous
Suggest you try the following...
when HTTP_REQUEST { switch -glob [HTTP::header "Accept-Language"] { en* { pool pool_app_english } jp* { pool pool_app_japanese } de* { pool pool_app_german } default { pool pool_app_english } } }
The accept language header defined in RFC7231 takes the form of 2 letter abbreviation of language followed by additional information. The above iRule allows you to pick pools for specific languages and even set a default. You can choose not have a default and it will use the pool attached to the virtual server instead.
- alex100_194614
Nimbostratus
Local traffic policy would do as well.
- Stanislas_Piro2
Cumulonimbus
Hi,
Accept-language is a list of all accept languages... if the first language is not in the list, check for the second one until you find one manage language...
when HTTP_REQUEST { pool pool_app_english foreeach language [split [HTTP::header "Accept-Language"] ","] switch -glob $language { "en*" { pool pool_app_english; break} "jp*" { pool pool_app_japanese ; break} "de*" { pool pool_app_german ; break} default { } } } }
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