Forum Discussion

shipszky_319427's avatar
shipszky_319427
Icon for Nimbostratus rankNimbostratus
Sep 18, 2017

Irule redirect issue with chrome

The following is a snip from a lare irule we use to redirect a group of websites

when HTTP_REQUEST {
   switch -glob [string tolower [HTTP::host]] {
"*abc.def.gov*" {
if {
([string tolower [HTTP::uri]] contains "/engagement" )}
{
         HTTP::redirect "https://123.456.gov/home-page/somesite/abc/community/"
      }
       HTTP::redirect "https://123.456.gov/home-page/somesite/abc/"
      }
}}

The issue we are having is the connection gets reset from some reason, but it only happens in chrome. IE, Firefox and Edge all work without issue. Also it only happens when someoene puts abc.def.gov/engagement

Thanks in advance

1 Reply

  • I'm not positive without testing but, based on your code snippet, it looks like when a client requests abc.def.gov/engagement, the switch condition is true and the first IF condition is true. That causes the first HTTP::redirect statement to execute. But since there is no ELSE condition for the second HTTP::redirect, my guess is that it, too, is executing, causing the reset condition. Some browsers may ignore a second redirect but Chrome may be sensitive to it and reset the connection.

     

    Either add an ELSE condition for the second redirect, or add a return after the first redirect to prevent the second from also executing.