Forum Discussion

Albert__Tase_70's avatar
Albert__Tase_70
Icon for Nimbostratus rankNimbostratus
Jan 03, 2007

ok here it is again now all but the last part is excepted

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 { ($uri starts_with "/registration/Modify_registration.taf") || ($uri starts_with "/registration/modify_registration.taf") || ($uri starts_with "/registration/index.taf") } {

 

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

 

} elseif { ($uri starts_with "/registration/register.taf") || ($uri equals "/pal/register/redirect.taf") } {

 

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

 

} elseif { ( $uri starts_with "/site_registration/site_login.taf") } {

 

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

 

} elseif { $uri equals "/site_registration/"} {

 

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

 

} elseif { ($uri starts_with "/site_registration/site_register.taf") } {

 

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

 

} elseif { ($uri starts_with "/offer/") || ($uri starts_with "/cgi-taf/links.taf") } {

 

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

 

} elseif { ($uri starts_with "/cgi-taf/button_link.taf") } {

 

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

 

} elseif { ($uri starts_with "/cgi-taf/subscribe_link.taf") } {

 

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

 

} elseif { ($uri starts_with "/dynasearch") || ($uri starts_with "/Dynasearch") || ($uri starts_with "/DynaSearch") } {

 

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

 

} elseif { ($uri starts_with "/cgi-taf/Ea2.taf") } {

 

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

 

} elseif { ($uri starts_with "/login/password_help.taf") } {

 

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

 

} elseif { ($uri starts_with "/help/advertising") } {

 

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

 

} elseif { $host contains "www.emboj.org"} {

 

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

 

} elseif { $host contains "emboreports.npgjournals.com"} {

 

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

 

} elseif { $host contains "embojournals.npgjournals.com"} {

 

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

 

} elseif { $host contains "www.npgjournals.com"} {

 

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

 

} elseif { $host contains "www.journalofmedicalmarketing.com"} {

 

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

 

} elseif { $host contains "www.damjournal.com"} {

 

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

 

} elseif { ($uri starts_with "/press/") } {

 

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

 

} elseif { ($uri starts_with "/public/") } {

 

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

 

} elseif { [HTTP::host] equals "www.nature.com" && [HTTP::uri] starts_with "/rss/" && [HTTP::uri] ends_with "/index.html" }

 

{HTTP::redirect "http://www.nature.com/webfeeds/index.html" } }}}

 

 

on the above rule I ghet the following error:

 

 

01070151:3: Rule [chris_test] error:

 

line 59: [parse error: extra characters after close-brace] [}

 

}]

 

line 60: [command is not valid in the current scope] [}]

 

 

please help me resolve this thanks

 

 

Al Tase

3 Replies

  • I cleaned up an earlier version of the rule you posted in this thread:

     

     

    Click here

     

     

    Can you take a look at that one and test it? I verified the syntax and layout of the rule. I'm not going to reformat this older version again and fix the errors.

     

     

    If you do have questions on the rule I posted in the other thread, please reply in that thread by clicking on the Add Reply button. Here is a copy of the link that you can use to reply to the correct thread...

     

     

    http://devcentral.f5.com/Default.aspx?tabid=28&forumid=5&view=post&postid=11907

     

    Click here

     

     

    Aaron
  • the above rule works except for the last part the rule you posted gives me syntx errors if I remove the following the rule works:

     

    elseif { [HTTP::host] equals "www.nature.com" && [HTTP::uri] starts_with "/rss/" && [HTTP::uri] ends_with "/index.html" }

     

    {HTTP::redirect "http://www.nature.com/webfeeds/index.html" } }}}

     

    unfortnately I need the last piece above to work also so please can someone tell me how to resolve the last errors which has to due with the above.

     

     

    thanks

     

     

    AL Tase
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Hi Al --

     

     

    Remove one of the closing curly braces and move the one preceding the HTTP::redirect command to the line above:
        } elseif { [HTTP::host] equals "www.nature.com" && [HTTP::uri] starts_with "/rss/" && [HTTP::uri] ends_with "/index.html" }{
          HTTP::redirect "http://www.nature.com/webfeeds/index.html"
         first closing curly brace terminates "if" statement
        }
       second one terminates HTTP_REQUEST event
      }
     third one terminates iRule
    }

     

     

    The next time you post, PLEASE post follow-up questions on the same topic on the same thread for continuity rather than beginning a new topic each time. Also, please try to follow Hoolio's suggestions re: formatting your code for readability (will make errors like that above more obvious).

     

     

    HTH

     

    /deb