Forum Discussion

gapexx_138014's avatar
gapexx_138014
Icon for Nimbostratus rankNimbostratus
Nov 25, 2014

notification irule

Hello

I am having problems with one irule. Irule is distributing connections to pools based on hostname. Rule is working fine. Then I tried to add notification for clients using sslv3 connections. This rule is partially working. Problem is that when you call hostname (e.g. test1.mysite.com) from browser and you are using sslv3, you get proper notification. But when you call direct application link (e.g. test1.mysite.com/index.php) notification doesn't appear.

Here is my irule


if { ([HTTP::host] starts_with "test1.") and ([SSL::cipher version] eq "SSLv3") } {
respond with notification page 
    switch [HTTP::uri] {
"/" {HTTP::respond 200 content [ifile get sslv3_response]}
"/logo.jpg" {HTTP::respond 200 content [ifile get logo]}
}
}
if { [HTTP::host] starts_with "test1." } {
pool TEST1_pool
}
if { ([HTTP::host] starts_with "test2.") and ([SSL::cipher version] eq "SSLv3") } {
respond with notification page 
    switch [HTTP::uri] {
"/" {HTTP::respond 200 content [ifile get sslv3_response]}
"/logo.jpg" {HTTP::respond 200 content [ifile get logo]}
}
}
if { [HTTP::host] starts_with "test2." } {
pool TEST2_pool
}
}

  • But when you call direct application link (e.g. test1.mysite.com/index.php) notification doesn't appear.

     

    because you do not have /index.php in switch pattern. you may try "default" switch pattern to catch all.

     

  • Thanks for the hint. You were right. I was missing pattern to catch all. I managed to solve issue with rule bellow. I had to use -glob, add pattern to catch all (/*) and also moved logo.jpg to the top.

    
    if { ([HTTP::host] starts_with "test2.") and ([SSL::cipher version] eq "SSLv3") } {
    respond with notification page 
        switch -glob [HTTP::uri] {
    "/logo.jpg" {HTTP::respond 200 content [ifile get logo]}
    "/" -
    "/*" {HTTP::respond 200 content [ifile get sslv3_response]}
    }
    }
    if { [HTTP::host] starts_with "test2." } {
    pool TEST2_pool
    }
    }
    
    • nitass's avatar
      nitass
      Icon for Employee rankEmployee
      thanks for update. i think not using -glob and changing /* to default will do the same too.