Forum Discussion

Joseph_Lindsly's avatar
Aug 20, 2018

whatismyip on the internal network

Is it possible to create an irule that would capture a users IP address and then provide it back to them in the browser? We have users that have a hard time figuring out how to get their IP address from that PC. I wanted to create a VIP (with no assigned server pool) and apply an irule that would capture the IP address and respond back to the user in the browser with their IP address. Has anyone created this before? If so, can you help me?

 

Thanks

 

2 Replies

  • Something like this?

    when HTTP_REQUEST {
        HTTP::respond 200 content "Your IP address is: [IP::client_addr]"
    }
    
    • DB's avatar
      DB
      Icon for Nimbostratus rankNimbostratus

      Trying to add this to a complex page being written by an irule that declares the HTML content in curly braces, like this:

         HTTP::respond 200 content {

          <html>

      .....

      }

       

      If I put the "[IP::client_addr]" into the bracketed content, it prints out [IP::client_addr] instead of the value. How do I get it to do the substitution and print the actual value?