Forum Discussion

Koalan's avatar
Koalan
Icon for Cirrus rankCirrus
Nov 28, 2019

iRule redirection HTTPS to port 2001

Hi this regarding my old question but more specific:

 

Setup:

 

VIP1: 1.1.1.1:443

irule: use to redirect

 

VIP2: 1.1.1.1:2001

POOL: 2.2.2.2:2001

 

So what I want is if the user access:

 

  1. https://1.1.1.1/Administration/services/ it should redirect it to http://1.1.1.1:2001/Administration/services/
  2. https://1.1.1.1/Administration/services/EyeQNissanSF?WSDL it should redirect it to http://1.1.1.1:2001/Administration/services/EyeQNissanSF?WSDL
  3. https://1.1.1.1/Administration/services/abcd it should redirect it to http://1.1.1.1:2001/Administration/services/abcd

and so on...

 

Can anyone help me build an iRule for this

3 Replies

  • will this work:

     

    when HTTP_REQUEST {

     if { [HTTP::host] eq "1.1.1.1" } {

      HTTP::redirect http://1.1.1.1:2001[HTTP::uri]

     }

    }

    • Share us your VIP1: 1.1.1.1:443 configuration.

      #tmsh list ltm virtual <vip1-name>

      • Koalan's avatar
        Koalan
        Icon for Cirrus rankCirrus

        ltm virtual 1.1.1.1_443 {

          destination 1.1.1.1:https

          ip-protocol tcp

          mask 255.255.255.255

          profiles {

            clientssl {

              context clientside

            }

            http { }

            tcp { }

          }

          rules {

            sfws_irule

          }

          source 0.0.0.0/0

          source-address-translation {

            type automap

          }

          translate-address enabled

          translate-port enabled

          vs-index 220

        }

         

        ltm virtual 1.1.1.1_2001 {

          destination 1.1.1.1:2001

          ip-protocol tcp

          mask 255.255.255.255

          pool POOL_2.2.2.2

          profiles {

            tcp { }

          }

          source 0.0.0.0/0

          source-address-translation {

            type automap

          }

          translate-address enabled

          translate-port enabled

          vs-index 221

        }

         

        The irule above is the one i used. and i think it works.