Forum Discussion

Michael_107360's avatar
Jun 27, 2015

pool selection with 301 redirect

The goal is for sessions coming into the virtual server on port 80 depending on the uri will stay on port 80 and be directed to a specific pool. However at the end if the uri is not matched they will get a 301 to https. What is happening is the uri gets matched for instance "http://www.companya.com/mobileapp/files/client-mobile-config.json" when this url comes in the get a 301 rather then staying on port 80 and going to the right pool. I have added logging to the {log local0. "Matched pool 2 paths for [HTTP::uri]" pool pool_1} and the uri is getting logged....but it then it seems to continue and get a 301 Any thoughts?

 

when HTTP_REQUEST { switch -glob [string tolower [HTTP::host][HTTP::uri]] { "www.companya.com/mobileapp" - "www.companya.com/content/files" {pool pool_1} "investor-relations.companya.com/" - "companyacareer.com/" - "joincompanya.com/" - "quotewi/" - "costcoautohome.com/" - "library.companya.com/" - "companyainsurance.com/" - "banking-credit.companya.com/" - "budgeting-investing.companya.com/" - "financial-goals.companya.com/" - "financial-planning.companya.com/" - "insurance.companya.com/" - "investment.companya.com/" - "mortgages-home-loan.companya.com/" - "retirement.companya.com/" - "companyaappupdate.com/" { } default {HTTP::respond 301 "Location" "https://www.companya.com[HTTP::uri]"} } }

 

3 Replies

  • Sorry for the missing format....

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::host][HTTP::path]] {
            "www.companya.com/mobileapp*" -
            "www.companya.com/content/files*" {pool V102.57-P11230}
            "investor-relations.companya.com/" -
            "companyacareer.com/" -
            "joincompanya.com/" -
            "quotewi/"  -
            "costcoautohome.com/" -
            "library.companya.com/" -
            "companyainsurance.com/" -
            "banking-credit.companya.com/" -
            "budgeting-investing.companya.com/" -
            "financial-goals.companya.com/" -
            "financial-planning.companya.com/" -
            "insurance.companya.com/" -
            "investment.companya.com/" -
            "mortgages-home-loan.companya.com/" -
            "retirement.companya.com/" -
            "companyaappupdate.com/" {  }
                    default 
            {HTTP::respond 301 "Location" "https://www.companya.com[HTTP::uri]"}
         }
    }
    
  • Actually this issue has been resolve....and the solution was...that using HTTP::uri cause the problem, it was the configuration however I changed it to HTTP::path Once it was switched I had no further issues. I guess I quite don't understand the difference between HTTP::uri vs HTTP::path?

     

    • Ronald_van_der3's avatar
      Ronald_van_der3
      Icon for Nimbostratus rankNimbostratus
      You are probably using variables in the URL e.g. ?test=1. If you use HTTP::uri the query string (variables) are also available in the return value. With HTTP::path you only get the path without the query string. e.g. http://www.google.com/?q=test HTTP::uri will return: '/?q=test' HTTP::path will return: '/' Hope this helps.