Forum Discussion

Albert__Tase_70's avatar
Albert__Tase_70
Icon for Nimbostratus rankNimbostratus
Dec 21, 2006

need help converting this rule from 4 to 9.2.4

{

 

if (http_host contains "demo.nature.com" or http_host contains "deutsche.nature.com" or http_host contains "mailart.nature.com" or http_host contains "fastart.nature.com") {

 

use pool nature

 

}

 

else if (http_header("User-Agent") contains "Google" or http_header("User-Agent") contains "google" or http_header("User-Agent") contains "Ask" or http_header("User-Agent") contains "msn") {

 

use pool spider_pool

 

}

 

else if (http_host contains "isn-online.org") {

 

if (http_uri == "/" or http_uri == "/index.html") {

 

redirect to "http://www.nature.com/isn"

 

}

 

else {

 

use pool Java

 

}

 

}

 

else if (http_host contains "www.palgrave-journals.com") {

 

if (http_uri == "/" or http_uri == "/index.html") {

 

redirect to "http://www.palgrave-journals.com/pal"

 

}

 

else if (http_uri == "/mysiteaccount") {

 

redirect to "http://www.palgrave-journals.com/nams/svc/mysiteaccount"

 

}

 

else if (http_uri starts_with "/cgi-bin" or http_uri starts_with "/services/link.taf" or http_uri == "/login/login.taf") {

 

use pool nature

 

}

 

else if (http_uri starts_with "/registration/Modify_registration.taf" or http_uri starts_with "/registration/modify_registration.taf" or http_uri starts_with "/registration/index.taf") {

 

redirect to "http://www.palgrave-journals.com/myaccount"

 

}

 

else if (http_uri starts_with "/registration/register.taf" or http_uri == "/pal/register/redirect.taf") {

 

redirect to "http://www.palgrave-journals.com/register"

 

}

 

else if (http_uri starts_with "/site_registration/site_login.taf") {

 

redirect to "http://www.palgrave-journals.com/nams/svc/mysiteaccount"

 

}

 

else if (http_uri == "/site_registration/") {

 

redirect to "http://www.palgrave-journals.com/nams/svc/mysiteaccount"

 

}

 

else if (http_uri starts_with "/site_registration/site_register.taf") {

 

redirect to "http://www.palgrave-journals.com/nams/svc/siteregister"

 

}

 

else if (http_uri starts_with "/offer/" or http_uri starts_with "/cgi-taf/links.taf") {

 

redirect to "http://www.palgrave-journals.com/empty.txt"

 

}

 

else if (http_uri starts_with "/cgi-taf/button_link.taf") {

 

redirect to "http://www.palgrave-journals.com/"

 

}

 

else if (http_uri starts_with "/cgi-taf/subscribe_link.taf") {

 

redirect to "http://www.palgrave-journals.com/subscribe"

 

}

 

else if (http_uri starts_with "/dynasearch" or http_uri starts_with "/Dynasearch" or http_uri starts_with "/DynaSearch") {

 

redirect to "http://www.palgrave-journals.com/common/access/replaced.vm"

 

}

 

else {

 

use pool palgrave-foxtrot

 

}

 

}

 

else if (http_uri starts_with "/cgi-bin" or http_uri starts_with "/services/link.taf" or http_uri starts_with "/ebd/cpd/" or http_uri starts_with "/doifinder/10.1057" or http_uri starts_with "/doifinder/10.1080" or http_uri == "/login/login.taf") {

 

use pool nature

 

}

 

else if (http_host contains "www.naturereprints.com") {

 

redirect to "http://www.nature.com/reprints/index.html"

 

}

 

else if (http_uri starts_with "/registration/Modify_registration.taf" or http_uri starts_with "/registration/modify_registration.taf" or http_uri starts_with "/registration/index.taf") {

 

redirect to "http://www.nature.com/myaccount"

 

}

 

else if (http_uri starts_with "/registration/register.taf") {

 

redirect to "http://www.nature.com/register"

 

}

 

else if (http_uri starts_with "/site_registration/site_login.taf") {

 

redirect to "http://www.nature.com/mysiteaccount"

 

}

 

else if (http_uri == "/site_registration") {

 

redirect to "http://www.nature.com/mysiteaccount"

 

}

 

else if (http_uri starts_with "/site_registration/site_register.taf") {

 

redirect to "http://www.nature.com/siteregister"

 

}

 

else if (http_uri starts_with "/offer/" or http_uri starts_with "/cgi-taf/links.taf") {

 

redirect to "http://www.nature.com/empty.txt"

 

}

 

else if (http_uri starts_with "/cgi-taf/button_link.taf") {

 

redirect to "http://www.nature.com/index.html"

 

}

 

else if (http_uri starts_with "/cgi-taf/subscribe_link.taf") {

 

redirect to "https://secure.nature.com/subscribe/nature"

 

}

 

else if (http_uri starts_with "/dynasearch" or http_uri starts_with "/Dynasearch" or http_uri starts_with "/DynaSearch") {

 

redirect to "http://www.nature.com/common/access/replaced.vm"

 

}

 

else if (http_uri starts_with "/cgi-taf/Ea2.taf") {

 

redirect to "http://www.nature.com/nature-events/search-events/index.html"

 

}

 

else if (http_uri starts_with "/login/password_help.taf") {

 

redirect to "http://www.nature.com/nams/svc/lostpassword"

 

}

 

else if (http_uri starts_with "/help/advertising") {

 

redirect to "http://npg.nature.com/media/nature/index.html"

 

}

 

else if (http_host contains "www.emboj.org") {

 

redirect to "http://www.nature.com/emboj/"

 

}

 

else if (http_host contains "emboreports.npgjournals.com") {

 

redirect to "http://www.nature.com/embor/"

 

}

 

else if (http_host contains "embojournals.npgjournals.com") {

 

redirect to "http://www.nature.com/emboj/"

 

}

 

else if (http_host contains "www.npgjournals.com") {

 

redirect to "http://www.nature.com/embojournal/"

 

}

 

else if (http_host contains "www.journalofmedicalmarketing.com") {

 

redirect to "http://www.palgrave-journals.com/jmm"

 

}

 

else if (http_host contains "www.damjournal.com") {

 

redirect to "http://www.palgrave-journals.com/dam"

 

}

 

else if (http_uri starts_with "/press/") {

 

redirect to "http://press.nature.com"

 

}

 

else if (http_uri starts_with "/public/") {

 

redirect to "http://nurture.nature.com/search"

 

}

 

else if (http_host == "www.nature.com" and http_uri starts_with "/rss/" and http_uri ends_with "/index.html") {

 

redirect to "http://www.nature.com/webfeeds/index.html"

 

}

 

else if (http_host contains "www.nature.com" and http_uri contains "/rss/") {

 

use pool spider_pool

 

}

 

else {

 

use pool Java

 

}

 

}

 

3 Replies

  • Wow, that's a long iRule...

    Here's a start of the first part to get you going. You should be able to figure out how to convert the rest from this...

    I stored some common values (host, user-agent, and uri) in local lower case variables to avoid multiple comparisons in some places just to account for case sensitivity.

    when HTTP_REQUEST {
      set host [string tolower [HTTP::host]]
      set ua [string tolower [HTTP::header "User-Agent"]]
      set uri [HTTP::uri]
      if { ($host contains "demo.nature.com") || 
           ($host contains "deutsche.nature.com") ||
           ($host contains "mailart.nature.com") ||
           ($host contains "fastart.nature.com") } {
         pool nature
      } elseif { ($ua contains "google") || ($ua contains "ask") || ($ua contains "msn") } {
        pool spider_pool
      } elseif { $host contains "isn-online.org" } {
        if { ($uri equals "/") || ($uri equals "/index.html" } {
          HTTP::redirect "http://www.nature.com/isn"
        } else {
          pool Java
        }
      } elseif { $host contains "www.palgrave-journals.com" } {
        if { ($uri equals "/") || ($uri equals "/index.html" } {
          HTTP::redirect "http://www.palgrave-journals.com/pal"
        } elseif { $uri equals "/mysiteaccount" } {
          HTTP::redirect "http://www.palgrave-journals.com/nams/svc/mysiteaccount"
        } elseif { ($uri starts_with "/cgi-bin") || 
                   ($uri starts_with "/services/link.taf") || 
                   ($uri equals "/login/login.taf") } {
          use pool nature
        } ...
      } ...
    }

    Good luck and let us know if you get stuck...

    -Joe
  • hey joe at the bootn of your text with all the } do I continue after that or do I insert before that ?

     

  • Continue where the ...'s are (that's where I left off in your original code). The last brace is the closing brace for the HTTP_REQUEST event. If you want to include code past that point you'll have to enclose it in a different event.

     

     

    -Joe