Forum Discussion

spgghosh_194562's avatar
spgghosh_194562
Icon for Nimbostratus rankNimbostratus
Jul 18, 2015

HTTP Redirect failure

Hi,

 

As part of Scheduled maintanace activity we have to put a maintanance page redirect I-Rule but its was not worked. Howerver i can see hit on I-rule statistics but redirect failed.,alos noticed in the same I-rule list some of them getting redirected.

 

Find teh URL details and I-Rule we put for Redirect.Please help to identify any issue in I-Rule config or any other issue.

 

Note:during I-Rule implementation we are not taking any VIP or Pool down,Maintanace page only required for specific pages.

 

Find the URL which we put maintanance page:

 

http://www.pb.com/bv2was/ViewAccountBalance.go http://www.pb.com/bv2was/SchedPayAgreement.go http://www.pb.com/bv2was/SelectAccount.go http://www.pb.com/bv2was/SchedPaySelectAccount.go http://www.pb.com/bv2was/MeterRefill.go http://www.pb.com/bv2was/TransferBalance.go http://www.pb.com/bv2was/AddPostage.go http://www.pb.com/bv2was/ViewAccountBalance.go http://www.pb.com/pbpcombinedactivity/combinedActivity.jsp http://www.pb.com/bv2was/SchedPayAgreement.go http://www.pb.com/bv2was/PurchasePowerActivities.go http://www.pb.com/bv2was/PbpMeterActivities.go http://www.pb.com/bv2was/PbpPrePayActivities.go http://www.pb.com/epp_hybrid/mailer/transferFunds.do http://www.pb.com/bv2was/AddPostage.go http://www.pb.com/bv2was/TransferBalance.go

 

Find I-Rule which we implemented:

 

when HTTP_REQUEST { if { [HTTP::uri] starts_with "/bv2was/ViewAccountBalance.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/SchedPayAgreement.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/SelectAccount.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/SchedPaySelectAccount.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/MeterRefill.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/TransferBalance.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/AddPostage.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/ViewAccountBalance.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/pbpcombinedactivity/combinedActivity.jsp" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/SchedPayAgreement.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/PurchasePowerActivities.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/PbpMeterActivities.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/PbpPrePayActivities.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/epp_hybrid/mailer/transferFunds.do" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/AddPostage.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } elseif { [HTTP::uri] starts_with "/bv2was/TransferBalance.go" } { HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" } else { pool } }

 

Note I-Rule redirection is not worked only for pages start with "bv2was" others worked fine.

 

Load balancer Details:

 

BIG-IP 10.2.1 Build 297.0 Final BIG-IP 3900

 

8 Replies

  • for one thing a huge elseif elseif elseif approach isn't the best way to handle this, please look into a switch statement.

     

    also it is wise to convert the HTTP::uri to lowercase (and also your matching URI) to prevent case issues.

     

    https://devcentral.f5.com/articles/-the101-irules-101-string-handling-and-manipulation

     

    further i only see URI starting with bv2was on the list, so i don't understand which ones worked. but when i go to the URI im redirected to the https site, it might be there is another iRule which does that redirect which conflicts with your maintenance irule.

     

    finally you might want to delete your company name from all those links.

     

  • Hi,

     

    Thanks for your suggestion and help, also find the URL which was working fine which already included in the I-Rule

     

    /pbpcombinedactivity/combinedActivity.jsp" /epp_hybrid/mailer/transferFunds.do

     

    Yes, we have redirect also placed under VIP for port 80 howerver I-Rule which was not working placed on VIP -443 also not working there no other I-Rule are placed.

     

  • Hi,

     

    Thanks for your suggestion and help, also find the URL which was working fine which already included in the I-Rule

     

    /pbpcombinedactivity/combinedActivity.jsp" /epp_hybrid/mailer/transferFunds.do

     

    Yes, we have redirect also placed under VIP for port 80 howerver I-Rule which was not working placed on VIP -443 also not working there no other I-Rule are placed.

     

  • ah, yeah should have looked better, i see those two now.

     

    i still see a redirect from http to https, so something must do that.

     

    as mentioned i would rewrite the iRule with a switch statement and string tolower and see if that helps at all.

     

  • Hi,

     

    Could you please help us to get the I-Rule with Switch function,also i tried with one else if statement also same issue noticed.

     

  • when HTTP_REQUEST { 
        switch -glob [string tolower [HTTP::uri]] {
            "/bv2was/viewaccountbalance.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/selectaccount.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/schedpayselectaccount.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/meterrefill.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/pbpcombinedactivity/combinedactivity.jsp*" {
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/schedpayagreement.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/purchasepoweractivities.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/pbpmeteractivities.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/pbpprepayactivities.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/epp_hybrid/mailer/transferfunds.do*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/addpostage.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            "/bv2was/transferbalance.go*" { 
                HTTP::redirect "http://www.pb.com/pbcom/maintenance.html" 
            } 
            DEFAULT { 
                pool www.pb.com-80 
            } 
        }
    }