Forum Discussion
Roger_Oliver_78
Nimbostratus
Jul 24, 2007More Custom WAP Irules
I first want to thank everyone that has done WAP before. I liked the Irules I saw and got most of them to work in my test. However I have a problem some of the newer phones do not allow multiple redirects and I'm running into a crunch.
This is a sample of the code that my "WAP content" provider wants me to use to do the redirection based on the phone. This is not an irule of course but I have to find a way to make it an irule. My site went pure Ruby on Rails so I'm kinda in a bind.
The problem is they need me to point different phones to different "http://wap.vendor.com/partnergenericURL"
<% String accept = request.getHeader("accept");
if (accept != null) {
int i = accept.indexOf("wap");
int j = accept.indexOf("vnd.wap.xhtml+xml");
if (i > 0 || j > 0)
response.sendRedirect("http://wap.vendor.com/partnergenericURL");
else
//display partner homepage page normally
} else {
// display partner homepage page normally
}
%>
I forgot to add this. This is my current Irule based on the WAP irules I have found here on the site. What they are "saying" is that Nextel and some other vendor do not allow more then one redirect.
----
when HTTP_REQUEST {
switch -glob [HTTP::header User-Agent] {
"*Java/1.4.1_02*" -
"*Blazer*" -
"*blazer*" -
"*palm*" -
"*Palm*" -
"*SMARTPHONE*" -
"*Smartphone*" -
"*smartphone*" -
"*MOT-*" -
"*RAZR*" -
"*AUDIOVOX*" -
"*Symbian*" -
"*symbian*" -
"*NOKIA*" -
"*Nokia*" -
"*Sony Ericsson*" -
"*Samsung*" -
"*LG 8*" -
"*Alcatel 735i*" -
"*Nextel*" -
"*Windows CE*" -
"*BlackBerry*" -
"*Blackberry*" -
"*NetFront*" {
HTTP::redirect "http://wap.vendor.com/foo"
return
}
}
switch -glob [HTTP::header Accept] {
"*text/vnd.wap.wml*" -
"*text/vnd.rim.html*" {
HTTP::redirect "http://wap.vendor.com/foo/wmlfeed"
return
}
}
switch -glob [HTTP::header User-Agent] {
"*hiptop*" -
"*AvantGo*" -
"*Danger*" {
HTTP::redirect "http://wap2.vendor.com/foo/xmlfeed"
return
}
}
----
Thank you all for your help and input. I'm going to continue to search the forums
- For this code
<% String accept = request.getHeader("accept"); if (accept != null) { int i = accept.indexOf("wap"); int j = accept.indexOf("vnd.wap.xhtml+xml"); if (i > 0 || j > 0) response.sendRedirect("http://wap.vendor.com/partnergenericURL"); else //display partner homepage page normally } else { // display partner homepage page normally } %>
when HTTP_REQUEST { if { [HTTP::header exists "accept"] } { switch -glob [HTTP::header "accept"] { "*wap*" - "*vnd.wap.xhtml+xml*" { HTTP::redirect "http://wap.vendor.com/partnergenericURL" } } } }
- Roger_Oliver_78
Nimbostratus
Thank you - Colin_Walker_12Historic F5 AccountIt looks like you're closer...let's see if I can help a little.
when HTTP_REQUEST { switch -glob [HTTP::header User-Agent] { "*hiptop*" - "*AvantGo*" - "*Danger*" { HTTP::redirect "http://wap.vendor.com/partnergenericURL-D" return } } switch -glob [HTTP::header Accept] { "*vnd.wap.xhtml+xml*" - "*vnd.rim.html*" { HTTP::redirect "http://wap.vendor.com/partnergenericURL-C" return } "*vnd.wap.html*" { HTTP::redirect "http://wap.vendor.com/partnergenericURL-B" return } "*text/vnd.wap.wml*" { HTTP::redirect "http://wap.vendor.com/partnergenericURL-A" return } } if { [matchclass [string tolower [HTTP::uri] ] starts_with $::ot_recover] > 0 } { pool OLD_WEB_POOL } else { pool WEB_POOL } }
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