Forum Discussion

amit_128525's avatar
amit_128525
Icon for Nimbostratus rankNimbostratus
Dec 05, 2013

irule not working

one of our requiremnet is that to define a irule which allow the few user in specific ip address to access the normal website but if the user comes from some other ip address apart from this ip address he should get "page not found " url , we have one irule for this but we are having issue when u put it in that even when we try to access from ip address 10.1.1.1 we are getting page not found . Please advise if missing something in irule

when HTTP_REQUEST { if { [HTTP::host] contains "a.b.com" } { switch [IP::addr [IP::client_addr] mask 255.255.255.255] { "10.1.1.1." {
pool Pool_A_Prod } default { HTTP::respond 200 content [b64decode [class element -name 0 DG_MAINTENANCE_HTML]] "Content-Type" "text/html" } } } }

3 Replies

  • I can't test it but I think that your problem comes from the point at the end of your IP.

     

    Could you test it please ?

     

  • hello thanks for reply that "." is typo mistake in copy paste , I have checked on F5 it doesnt work still with ip address 10.1.1.1 . If any one can help me thanks when HTTP_REQUEST { if { [HTTP::host] contains "a.b.com" } { switch [IP::addr [IP::client_addr] mask 255.255.255.255] { "10.1.1.1" { pool Pool_A_Prod } default { HTTP::respond 200 content [b64decode [class element -name 0 DG_MAINTENANCE_HTML]] "Content-Type" "text/html" } } } }

     

  • I made a test and this iRule works for me.

    Can you try to :

    1 Replace [IP::addr [IP::client_addr] mask 255.255.255.255] by [IP::client_addr]

    2 And also add a log before your if with that line :
    log local0. "Client IP : [IP::client_addr] and Host reached : [HTTP::host] "