Forum Discussion

lieweffect_3313's avatar
lieweffect_3313
Icon for Nimbostratus rankNimbostratus
Aug 22, 2017

Mulitiple name redirect to URL

Hi,

 

I have URL as , when typing at the browser, it will auto redirect to folder and the URL at the browser will show https://www.abc.com/xyz/Login.aspx?ReturnUrl=%2fxyz

 

Question: How do I write iRule, whenever user type (in either one of these conditions):

 

  1. http://www.abc.com
  2. http://www.abc.com/xyz
  3. https://www.abc.com
  4. https://www.abc.com/xyz

it will go able to reach and it automatically resolve https://www.abc.com/xyz/Login.aspx?ReturnUrl=%2fxyz

 

Apparently, I have 2 VIPs(http and https), how should I write the iRule for both?

 

Thanks

 

2 Replies

  • Question: How do I write iRule, whenever user type (in either one of these conditions): http://www.abc.com http://www.abc.com/xyz https://www.abc.com https://www.abc.com/xyz

     

    So thats 3 http URL and 2 https urls, but all these 5 URL's still resolve to same VIP. If the traffic comes on http - it would goto 1.1.1.1:80 VIP, if the traffic comes to https - it would goto 1.1.1.1:443 VIP.

     

    So you require all 3 URL's to goto https, a simple http2https Irule on the 1.1.1.1:80 VIP should do the work.

     

    1. When traffic comes, it would goto https://www.abc.com
    2. When traffic comes, it would goto https://www.abc.com/xyz
    3. When http://www.abc.com traffic comes, it would goto https://www.abc.com
    4. When http://www.abc.com/xyz traffic comes, it would goto https://www.abc.com/xyz
  • Hi,

    you can try this irule

    when HTTP_REQUEST {
        if {[HTTP::host] equals "www.abc.com"} {
            switch [HTTP::path] {
                "/" - "/xyz" {HTTP::respond 301 Location "https://www.abc.com/xyz/Login.aspx?ReturnUrl=%2fxyz"}
            }
        }
    }
    

    For you information, even if user enter in browser bar ";, ";, ";, ";, "; or ";, the HTTP request is the same:

    GET / HTTP/1.1
    Host: www.abc.com
    User-Agent: blablabla
    Other headers: blablabla