Forum Discussion

Yogi's avatar
Yogi
Icon for Nimbostratus rankNimbostratus
Apr 08, 2020

Adding Clinet IP in the response page

Hi Mates,

 

I have a requirement that i need to add client IP in the response page for a vitual server. I was creating it in lab for every request hitting to virtual sevre should show a page to client with his/her address on that. I wrote an irule but instaled showing the client ip value it is showing the variable name that i set in the irule. Can anyone help me to fix that. Below is the irule, I have written

 

when HTTP_REQUEST {

  set IP IP::client_addr

  HTTP::respond 200 content {

     <html>

        <head>

           <title>Apology Page</title>

        </head>

        <body>

           Access is restricted for client ip $IP

        </body>

     </html>

  }

}

 

5 Replies

  • This will work... Modified iRule

    when HTTP_REQUEST {
      set IP [IP::client_addr]
      log local0. "Client IP is [IP::client_addr]"  
      HTTP::respond 200 content {
         <html>
            <head>
               <title>Apology Page</title>
            </head>
            <body>
               Access is restricted for client ip "[IP::client_addr]"
            </body>
         </html>
      }
    }
    • Yogi's avatar
      Yogi
      Icon for Nimbostratus rankNimbostratus

      Tried this as well, it is not working.