Forum Discussion

Reginald_Sible1's avatar
Reginald_Sible1
Icon for Nimbostratus rankNimbostratus
Aug 16, 2019

80 443 redirect with Host redirect

I'm trying to create a 80 to 443 redirect for *.xyz-dev.com

but in same rule i need if it comes in as a .net to redirect to a .com

 

*.xyz-dev.net port 80 will redirect to *.xyz-dev.com port 443

 

3 Replies

  • Try this iRule

    when HTTP_REQUEST {
        if {[HTTP::host] contains ".xyz-dev"} {
            switch -glob [HTTP::host] {
                "*.net" {
                    HTTP::redirect https://[string map {"net" "com"} [HTTP::host]][HTTP::uri]
                }
                default {HTTP::redirect https://[HTTP::host][HTTP::uri]}
            }
        }
    }
    • Lee_Sutcliffe's avatar
      Lee_Sutcliffe
      Icon for Nacreous rankNacreous

      No worries, happy to help.

      Please upvote/accept answer to help other users in the future who may have a similar problem.