Forum Discussion

eugeneK_pdx's avatar
eugeneK_pdx
Icon for Nimbostratus rankNimbostratus
Oct 23, 2013

Check and replace query string parameter called site for google GSA

I need some help writing an iRule for checking valid values for the parameter site and replace the value with empty-collection if the value does not match www-public-1, www-sec-1, www-sec-2.

 

when HTTP_REQUEST { switch -glob [string tolower [URI::query "?[HTTP::query]" site]] { If site parameter value matches www-public-1, www-sec-1 and www-sec-2, then no modifications "www-public-1" - "www-sec-1" - "www-sec-2" { HTTP::uri } If no match above then use site=empty-collection I do not know how to change value of site while maintaining the rest of the parameters default { HTTP::uri assign_string } } }

 

1 Reply

  • I got this to work with following: when HTTP_REQUEST { set site_param_value [string tolower [URI::query "?[HTTP::query]" site]] switch -glob $site_param_value { "www-public-1" { HTTP::uri } "www-sec-1" { HTTP::uri } "www-sec-2" { HTTP::uri } default { HTTP::uri [string map {"site=$site_param_value" "site=empty-collection"} [HTTP::uri]] } } }