For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

pr's avatar
pr
Icon for Nimbostratus rankNimbostratus
Mar 28, 2017

Need suggestion on and operation

HI All,

 

I am looking to achieve for below url if webservices string comes in http::uri & end with .asmx keyword then virtual server will send the traffic to pool otherwise it will redirect to https. But it is not working as expected...

 

Below is the url :

 

http://powerup-qa.directenergy.com/webservices/fidelitypaymentswebservice.asmx

 

Irule using :

 

when HTTP_REQUEST { if {([HTTP::host] equals "powerup-qa.directenergy.com") and ([HTTP::uri] starts_with "/webservices/") and ([HTTP::path] ends_with ".asmx")} { pool Powerup-QA_pool_http } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } }

 

1 Reply

  • Hi,

    did you assign this irule to HTTP VS only (if assigned to HTTPS VS, it will loop)

    The irule seems right (why using HTTP::uri for the start, and HTTP::path for the end... use HTTP::path for both start and end)

    if you want to allow uppercase, convert HTTP::path to lower case.

    when HTTP_REQUEST {
        set path [string tolower [HTTP::path]]
        if {([HTTP::host] equals "powerup-qa.directenergy.com") and ($path starts_with "/webservices/") and ($path ends_with ".asmx")} {
            pool Powerup-QA_pool_http
        } else {
            HTTP::redirect https://[HTTP::host][HTTP::uri]
        }
    }
    

    Or if you want to manage only host powerup-qa.directenergy.com:

    when HTTP_REQUEST {
        set path [string tolower [HTTP::path]]
        if {([HTTP::host] equals "powerup-qa.directenergy.com")} {
            if {($path starts_with "/webservices/") and ($path ends_with ".asmx")} {
                pool Powerup-QA_pool_http
            } else {
                HTTP::redirect https://[HTTP::host][HTTP::uri]
            }
        } else {
            Host header value not managed by the irule
        }
    }