Forum Discussion
Joe_Fontes_4518
Oct 16, 2006Nimbostratus
X-Forwarded-For iRule
To start I am very new to F5 products and thus know nothing about iRules. The only thing I know is what I need one to do.
I have enabled the X-Forwarded-For option for the sites and they are logging correctly. The issue I am having is that I get the client address when the requests come through the LB but is there any way to create an iRule that swaps out the actual host instead of needing the X-Forwarded-For?
The reason I ask is that we have some traffic that goes directly to the site's IP address and thus does not set that variable. So right now I can either log traffic going directly to the machine OR traffic coming from the LB not both. This is really starting to mess with our stats reporting.
Any ideas?
- hooleylistCirrostratusThe reason you would only see the BIG-IP's self IP or SNAT address as the source is if you have SNAT enabled on the VIP. Typically this is done in a network where the nodes aren't configured with the BIG-IP as their default gateway.
- Joe_Fontes_4518NimbostratusThank you for the responce and as suggested, changing the default route is not an option.
- If all you want to do is modify the host header (that's what I'm reading from the first message in the thread), then you can use the HTTP::host command to modify that value.
when HTTP_REQUEST { HTTP::host "newhostname" }
- JRahmAdminIt was my understanding that HTTP::host can only be returned, not set. Is this not correct? I get an error when I try that syntax.
- I stand corrected. I'm not sure why that is read-only but the workaround is to do a HTTP::header replace command on the Host header.
when HTTP_REQUEST { HTTP::header replace "Host" "newhostname" }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects