Forum Discussion
Jean_42123
Mar 06, 2011Nimbostratus
i-rule for HTTP header based on the Accept-Language
Hi Guys, Is it possible to write an i-rule to check the HTTP headers based on the "Accept-Language" field. thanks in advance. Jean
Bhuvnesh_9727
Mar 07, 2011Nimbostratus
Hi Chris,
In Accept_Language field we are getting following two different valuse based on Mobile handset language. They are
Accept-Language: ar\r\n (When handset language is Arabic)
Accept-Language: en;q=1.0,fr;q=0.5,ar;q=0.5\r\n (When handset language is English)
We want to redirect the URL to other sub URL based on language field. If it is Arabic then to arabic page else to english page.
I have written the following iRule.
rule myword_new
{
when HTTP_REQUEST
{
if {[HTTP::uri]=="/" or [HTTP::uri]==""}
{
if { [HTTP::header "Accept-Language"] starts_with "ar" }
{
HTTP::redirect "http://mydomain/dsb/user-agent/arabic/index.ar"
}
else
{
HTTP::redirect "http://mydomain/dsb/user-agent/english/index.en"
}
}
}
}
Will it work?
Thanks
Bhuvnesh
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