Forum Discussion
dragonflymr
Cirrostratus
May 18, 2015Switching iRule help
Hi,
I am trying to understand if rule posted below can be somehow changed/optimized.
Is this sequence best way to achieve what this iRule is designed for:
set cmd "HTTP::respond 302 Location \...
giltjr
Nimbostratus
May 19, 2015You will, of course, need to do testing but I think this should get the same results without the redirects.
when HTTP_REQUEST {
Insert Cookies for policy switching
set setcookie ""
log local0. "Cookie $setcookie"
log local0. "Client [IP::client_addr] connected from switch"
set vip "/Common/v.dc.wa_default_0.app/v.dc.wa_default_0_vs"
switch [string tolower [HTTP::uri]] {
"/none" { set setcookie "none ; Expires=Thu, 01 Jan 1970 00:00:01 GMT\" }
"/tcp" { set setcookie "tcp\" ; set vip "/Common/v.dc.wa_default_0.app/v.dc.wa_default_0_vs" ; COMPRESS::disable }
"/compress" { set setcookie "compress\" ; set vip "/Common/v.dc.wa_compress_1.app/v.dc.wa_compress_1_vs" ; COMPRESS::enable }
"/ibr" { set setcookie "ibr\" ; set vip "/Common/v.dc.wa_ibr_2.app/v.dc.wa_ibr_2_vs" ; COMPRESS::enable }
"/img" { set setcookie "img\" ; set vip "/Common/v.dc.wa_img_3.app/v.dc.wa_img_3_vs" ; COMPRESS::enable }
"/reorder" { set setcookie "reorder\" ; set vip "/Common/v.dc.wa_reorder_4.app/v.dc.wa_reorder_4_vs" ; COMPRESS::enable }
"/spdy" { set setcookie "spdy\" ; set vip "/Common/v.dc.wa_spdy_5.app/v.dc.wa_spdy_5_vs" ; COMPRESS::enable}
"/http2" { set setcookie "http2\";set vip "/Common/v.dc.wa_http2_6.app/v.dc.wa_http2_6_vs" ; COMPRESS::enable }
"/oc" { set setcookie ; "OneConnect\" set vip "/Common/v.dc.wa_oc_7.app/v.dc.wa_oc_7_vs" ; COMPRESS::enable }
}
log local0. "Cookie $setcookie"
log local0. "Virtual $vip"
virtual $vip
if { [string tolower [HTTP::uri]] eq "/current" } {
HTTP::respond 200 content "Current cookie setting for X-WA-Policy is: [HTTP::cookie "X-WA-Policy"]"
}
}
when HTTP_RESPONSE {
HTTP::header insert "X-DC-Virtual" $vip
if { [string length $setcookie] > 0 } {HTTP::cookie insert name "X-WA-Policy" value $setcookie}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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