Forum Discussion
Receive original IP throught proxies and LTM or no header at all
Hello,
Currently. We are working on on this Irule which keeps all x-forward headers sent by our proxies (You will surely recognize it) :
when HTTP_REQUEST { HTTP::header insert HeadTrans [HTTP::header all];
if {[HTTP::header exists X-Forwarded-For]}{ HTTP::header replace X-Forwarded-For "[HTTP::header X-Forwarded-For]"; } else { HTTP::header insert X-Forwarded-For [getfield [IP::client_addr] "%" 1]; }
Have question about this. If I just want to keep the first action and remove the "else" part... Which mean if the LTM don't found any existing headers I would like to have no header at all. Do I have to have explicit "else { do nothing } or can I only keep my first condition like :
when HTTP_REQUEST { HTTP::header insert HeadTrans [HTTP::header all];
if {[HTTP::header exists X-Forwarded-For]}{ HTTP::header replace X-Forwarded-For "[HTTP::header X-Forwarded-For]"; }
Best regards,
Yves
no you don't need to have an explicit "else { do nothing }" section.
- Stanislas_Piro2
Cumulonimbus
Hi,
I don't understand the goal of the question. If the header exists, you replace it with the same value, and if the header does not exist, do not insert it... remove the condition will do the same.
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