Forum Discussion

drew_23351's avatar
drew_23351
Icon for Nimbostratus rankNimbostratus
Aug 15, 2014

HTTPS to HTTP irule

I'm trying to get an irule to work, but can't figure out what's wrong. What I'm wanting to do is redirect an https request on one url to a http on a different url. The rule that's not working is:

 

when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "somedomainname.com/coatty/" && [TCP::local_port] == 443 } { HTTP::redirect "http://somedomainname.com[HTTP::uri]" } }

 

Thanks

 

6 Replies

  • HTTP::uri will only contain the /coatty portion. somedomainname.com is the HTTP::host. Try this iRule:

    when HTTP_REQUEST { 
     if { [string tolower [HTTP::uri]] starts_with "/coatty" && [TCP::local_port] == 443 } {
      HTTP::redirect "http://somedomainname.com[HTTP::uri]" 
     } 
    }
    
  • Thanks... Now how would I get the redirect to remove the /coatty part?

     

  • Do you want to redirect without preserving the URI, or redirect preserving the URI with the exception of the /coatty portion?

     

  • with out preserving the uri. https://www.somedomain.com/coatty to http://www.someotherdomain.com