Forum Discussion
I have SNAT and X-Forwarded-For but this is not working for internal application need to insert WL-Proxy-Client-IP in below iRule please guide.
Below is the existing iRule applied to VIP and want to need to insert WL-Proxy-Client-IP in below iRule
ltm rule uri_pool_select { when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] switch -aaaa $uri { /bbbb* - /cccc* { pool wxyz.com } default { pool default.com } } } }
iRule for inserting WL-Proxy-Client-IP
when HTTP_REQUEST { HTTP::header insert X-Forwarded-For [IP::remote_addr] }
please guide on how to combine these two rules?
8 Replies
- nitass
Employee
please guide on how to combine these two rules?
since their actions do not conflict, you can just combine them (to one HTTP_REQUEST).
- Amol_Khatavkar_
Nimbostratus
I guess this will work
ltm rule uri_pool_select { when HTTP_REQUEST { HTTP::header insert X-Forwarded-For [IP::remote_addr] and { set uri [string tolower [HTTP::uri]] switch -aaaa $uri { /bbbb* - /cccc* { pool wxyz.com } default { pool default.com } } } }
Please guide me on the above configuration.
- nitass
Employee
e.g.
when HTTP_REQUEST { HTTP::header insert X-Forwarded-For [IP::remote_addr] set uri [string tolower [HTTP::uri]] switch -glob $uri { /bbbb* - /cccc* { pool wxyz.com } default { pool default.com } } } - Amol_Khatavkar_
Nimbostratus
Hi Nitass,
Thanks and for your input.Can you confirm if this will work with AND operator also as below?
ltm rule uri_pool_select { when HTTP_REQUEST { HTTP::header insert X-Forwarded-For [IP::remote_addr] and { set uri [string tolower [HTTP::uri]] switch -aaaa $uri { /bbbb* - /cccc* { pool wxyz.com } default { pool default.com } } } } }
Thank again.
- nitass
Employee
no, it won't work.
- Amol_Khatavkar_
Nimbostratus
Hi Nitass,
Thanks for your response.
Can you tell me the difference between below two lines,
HTTP::header insert X-Forwarded-For [IP::remote_addr]
HTTP::header insert WL-Proxy-Client-IP [IP::client_addr]
Thanks again.
- nitass
Employee
Can you tell me the difference between below two lines
Returns the IP address of the host on the far end of the connection. In the clientside context, this is the client IP address. In the serverside context this is the node IP address. You can also specify the IP::client_addr and IP::server_addr commands, respectively.IP::remote_addr
https://devcentral.f5.com/wiki/iRules.IP__remote_addr.ashx - Mahmoud_Eldeeb_
Cirrostratus
combine both to one HTTP_REQUEST
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