Forum Discussion

Pav_70755's avatar
Pav_70755
Icon for Nimbostratus rankNimbostratus
Apr 20, 2011

I-rule to re-direct page back to source IP address?!

We have a site that is hosted through our F5 and it has a page which returns the users IP address so the source ip of the user accessing the site but the IP that is being returned is the floating IP of the Big IP.

 

 

Is there specific setting in the virtual server set up or does something need to specified in an i-rule for it to route back to the source IP and not the floating IP?

 

 

any help much appreciated!

 

 

 

Thanks

 

 

 

Pav

 

  • As Hoolio mentioned this was to see if the application might have been looking at other HTTP headers where it could be pulling the information. However, it is looking more and more like the application is indeed looking at the packet information.

     

     

    Bhattman
  • Hi Pav,

     

    Is there any specific reason why you are using AUTOSNAT? Was it to solve a particular problem?

     

     

    thanks,

     

    Bhattman

     

  • I think I originally set that by default and after removing the SNAT Poole to automap it worked :-)

     

     

    thanks for your help Battman
  • my second question is can the X-Forwarded for be used to return the external IP address for the site?

     

     

     

    Thanks

     

     

     

    Pav
  • I don't believe that it can.

     

     

    When enabled, the system inserts an XForwarded For header in an HTTP request with the Client IP Address.
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Well, technically, with an iRule couldn't you write whatever you want into a header named...whatever you want? (X-forwarded-for included)

    I'm not saying the other systems would know what the heck to do with it, but I would think you could get there:

    
    when HTTP_REQUEST {
      HTTP::header insert X-Forwarded-For [IP::local_addr]
    }
    

    You might need to use header replace instead if it's already getting put in somewhere else along the line.

    Colin
  • I agree with Colin, you might be able to do something like that, but even using the [IP::local_addr], just returns the IP Address of the Virtual Server that the iRule is running on and the other systems might not know what to do with it.

     

     

    That seems kind of risky to me. :-)
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    ^ Yep, what he said. You CAN do pretty much anything you want in iRules. Just make sure you really want to do it first. ;)

     

     

    Colin