Forum Discussion
irules - reverse proxy with x-forwarder for http
Hi
can someone help to write multiple conditional statements in one if statement. Basically I'm trying to club the reverse proxy iRule for Lync and iRule to insert the original client IP address in an X-Forwarded-For HTTP header. I'm poor in writing irules. can someone help with basics and let me know what is going wrong if I use the following irule.
the requirement : The rule should act as reverse proxy and server should log with the original client Ip address instead of LTM's self IP address as I have SNAT automap enabled.
when HTTP_REQUEST { ([HTTP::header] insert X-Forwarded-For [IP::remote_addr]) and ([HTTP::uri] contains "WebTicket/WebTicketService.svc/Auth") } {
switch [string tolower [HTTP::host]] {
tokyo.lync4u.com { pool pool_test_lync13 } } } }
Its throwing me errors, I tried to work. but as I have less knowledge on irules, I want some assistance from you guys.
can someone try to amend the irule for me so that
7 Replies
- Cory_50405
Noctilucent
You can enable the insertion of the X-forwarded-for header in the HTTP profile you have applied to your virtual server. Is there a reason you need to do it through an iRule instead of the HTTP profile?
- newf5learner
Nimbostratus
though I have enabled that in http profile, logging at the server end doesn't give me any information about the client IP addresses, I can only see the LTM self IP addresses. - Cory_50405
Noctilucent
You can verify it's being inserted by doing a tcpdump on the LTM and digging into the HTTP information being sent to the server.
- kunjan_118660
Cumulonimbus
Have you configured the web server to log "X-forwarded-for" header? Something like this
- newf5learner
Nimbostratus
thanks all.. this has been fixed.!! Its a problem on the server.
- newf5learner
Nimbostratus
thanks all.. this has been fixed.!! Its a problem on the server.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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