cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Clinet IP in the response page

Yogi
Nimbostratus
Nimbostratus

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 5

Samir
Nacreous
Nacreous

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
Nimbostratus
Nimbostratus

Tried this as well, it is not working.

Modified irule. see the logs in /var/ltm also.

Yogi
Nimbostratus
Nimbostratus

I can see the ip in logs but on the respinse page it is not showing IP address instaed showing variable name or what ever we are writting in the boday it is taking as text

 

Access is restricted for client ip [IP::client_addr]

Irule is correct, You can try one more time... without quote