Forum Discussion

Pete_Paiva_7147's avatar
Pete_Paiva_7147
Icon for Nimbostratus rankNimbostratus
Aug 28, 2007

https to http redirect

I'm looking to create an iRule that will take https://my.mycompany.com and redirect it to http://my.mycompany.com.

 

 

So in other words, if someone were to put in https:// it would redirect them to http:// -- the URL would stay exactly the same.

 

 

Any help would be greatly appreciated.

 

 

Thanks,

 

-Pete
  • Hamish,

     

     

    Thanks for the response. That one I already have working in our environment. I tried playing around with the syntax but I can't get it correctly.

     

     

    Any further help would be greatly appreciated.

     

     

  • I have a similar setup in one of my rules, this is a permanent redirect (301):

    
    when HTTP_REQUEST {
     switch -glob [string tolower [HTTP::host]] {
      "my.mycompany.com" {
       HTTP::respond 301 \
       "Location" "http://my.mycompany.com[HTTP::uri]" \
       return 0
      }
     }
    }  

    Or if you're looking for a temp redirect (302):

    
    when HTTP_REQUEST {
     switch -glob [string tolower [HTTP::host]] {
      "my.mycompany.com" {
       HTTP::redirect "http://my.mycompany.com[HTTP::uri]"
       return 0
      }
     }
    }  
  • I think I'm doing something wrong -- neither of the 2 iRules seem to be working correctly. I replaced the "my.mycompany.com" with the actual URL but still not having any luck. The https url doesn't seem to be redirecting to http.