Forum Discussion

Anil_Gupta_01_1's avatar
Anil_Gupta_01_1
Icon for Nimbostratus rankNimbostratus
Jul 16, 2014

irule for sending traffic on particular subdirectory of website

I have small query w.r.t irule for sending traffic on particular sub directory of the server rather than sending to root directory of the website.

 

Server is working on below mention website. http://aol.xyz.com:8060/ ----- Pool created is aol_pool is working on port 8080 http://yahoo.xyz.com:8443/OA_HTML/RF ----- Pool created is yahoo_pool is working on port 8443 http://google.xyz.com:7443/IA_HTML/RF ----- Pool created is google_pool is working on port 7443

 

Since customer want to access all three website on single IP Address; I have created Virtual server on port 443 port and called below irule.

 

when HTTP_REQUEST { if { [HTTP::host] equals "aol.xyz.com" } { pool aol_pool } elseif { [HTTP::host] equals "yahoo.xyz.com" } { pool yahoo_pool } elseif { [HTTP::host] equals "google.xyz.com" } { pool google_pool } else { discard } }

 

For this my aol.xyz.com is working; but other website i.e. yahoo.xyz.com and google.xyz.com is not working; since the website is working on particular website. Request you to please help to create irule is this.

 

5 Replies

  • Hi Anil,

    try this:

    when HTTP_REQUEST {
        switch [string tolower [HTTP::host]] {
            aol.xyz.com { pool aol_pool }
            yahoo.xyz.com   { pool yahoo_pool }
            google.xyz.com  { pool google_pool }
            default { discard }
            }
    }
    

    Regards Andréas

  • Hi,

     

    I want to send traffic to particular pool and then add To particular extension of URL

     

    example :--

     

    if user is trying https://yahoo.xyz.com F5 VS should select yahoo_pool and also add extension to the website /OA_HTML/RF to the website.

     

    Thanks.

     

  • Hi,

     

    If I understand you want the request sent to the yahoo_pool with the URI /OA_HTML/RF?

     

    then do this:

     

    when HTTP_REQUEST {
        switch [string tolower [HTTP::host]] {
            aol.xyz.com { pool aol_pool }
            yahoo.xyz.com   
            { 
                HTTP::uri "/OA_HTML/RF"
                pool yahoo_pool 
            }
            google.xyz.com  
            { 
                HTTP::uri "/IA_HTML/RF"
                pool google_pool 
            }
            default { discard }
            }
    }

    With this code my webserver access.log looks like this: 192.168.90.2 - - [16/Jul/2014:14:21:29 +0200] "GET /OA_HTML/RF HTTP/1.1" 404 444 "-" "curl/7.30.0"

     

    Regards Andréas

     

  • Thanks Andreas..I will try this tomorrow and will let you know the result..

     

    just for some clarification:- I need to create VS on port 443 and and select this irule for pool selection based on URL.