Forum Discussion

chungyu_16122's avatar
chungyu_16122
Icon for Altostratus rankAltostratus
Feb 17, 2012

Troubleshooting an HTTP Redirect iRule

Hi all

 

 

I am using an iRule to handle HTTP redirects, it works all my sites but 2, not sure why since the rule format is identical and the irules statistics does not show any failures or aborts.

 

 

The last two redirects "bloomsday" and "mcll" return page 404 not found.

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::uri]] {

 

"prodep" {

 

HTTP::redirect ""

 

}

 

"prodev" {

 

HTTP::redirect ""

 

}

 

"potentiel" {

 

HTTP::redirect ""

 

}

 

"potential" {

 

HTTP::redirect ""

 

}

 

"milr" {

 

HTTP::redirect ""

 

}

 

"langue" {

 

HTTP::redirect "http:://[HTTP::host]/conted/langprg/fulltimefrench/"

 

}

 

"language" {

 

HTTP::redirect "http:://[HTTP::host]/conted/langprg/fulltimeenglish/"

 

}

 

"eflp" {

 

HTTP::redirect "http:://[HTTP::host]/conted/langprg/"

 

}

 

"continue" {

 

HTTP::redirect "http:://[HTTP::host]/conted/prodep/"

 

}

 

"conted-translation" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/translation/"

 

}

 

"conted-span-port" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/spanport/"

 

}

 

"conted-general" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/facultypartnerships/"

 

}

 

"conted-cms" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/cms/"

 

}

 

"conted-apply" {

 

HTTP::redirect "http:://[HTTP::host]/conted/applyregister/"

 

}

 

"cce-internet" {

 

HTTP::redirect "http:://[HTTP::host]/conted/programs/grad/it/"

 

}

 

"cce-translation" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/translation/"

 

}

 

"cce-spanish" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/spanport/"

 

}

 

"cce-programs" {

 

HTTP::redirect "http:://[HTTP::host]/conted/programs/"

 

}

 

"cce-info" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/infosessions/"

 

}

 

"scs-internet" {

 

HTTP::redirect "http:://[HTTP::host]/conted/programs/grad/it/"

 

}

 

"scs-translation" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/translation/"

 

}

 

"scs-spanish" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/spanport/"

 

}

 

"scs-info" {

 

HTTP::redirect "http:://[HTTP::host]/conted/acad/infosessions/"

 

}

 

"bloomsday" {

 

HTTP::redirect "http:://[HTTP::host]/conted/milr/bloomsday/"

 

}

 

"mcll" {

 

HTTP::redirect "http:://[HTTP::host]/conted/milr/"

 

}

 

}

 

}

 

 

 

 

 

3 Replies

  • I would start with some logging.

    
    "bloomsday" {
      log local0.debug "bloomsday redirect -- [HTTP::uri]"
      HTTP::redirect "http:://[HTTP::host]/conted/milr/bloomsday/"
    }
    "mcll" {
      log local0.debug "mcll redirect -- [HTTP::uri]"
      HTTP::redirect "http:://[HTTP::host]/conted/milr/"
    }
    

    If you get hits in /var/log/ltm, then your logic was correct. At that point I would verify the redirect. Can you actually pull that page up in a browser?

    If you don't get anything in the logs, I would add a logging line before your switch statement and log [HTTP::uri] and verify that your requested page has the URL you are expecting.

    I don't see anything obviously wrong with your rule. That's how I would approach troubleshooting it though.

    Richard
  • Thanks for the input, and I will try it out.

     

     

    If I input the links directly in a browser, I can get the right page. I added the logging line and will test it our.

     

     

     

     

     

  • did you forget asterisk (*)?

    e.g.

    
       "*bloomsday*" {
          HTTP::redirect "http:://[HTTP::host]/conted/milr/bloomsday/"
       }
       "*mcll*" {
          HTTP::redirect "http:://[HTTP::host]/conted/milr/"
       }