NetScaler-13.1-How to add the X-Forwarded-For header as the first HTTP header in the request.

book

Article ID: CTX695893

calendar_today

Updated On:

Description

The following commands can add "X-Forwarded-For" header as the first HTTP header. And it works for both HTTP/1.1 and HTTP/1.0.

add rewrite action xForwardedFor-act replace_all HTTP.REQ.FULL_HEADER q/HTTP.REQ.VERSION+"\r\nX-Forwarded-For: "+CLIENT.IP.SRC.TYPECAST_TEXT_T+"\r\n"/ -search q{regex(re~HTTP/1\.[01]\r\n~)}
add rewrite policy xForwardedFor-pol true xForwardedFor-act
bind lb vserver <vserver_name> -policyName xForwardedFor-pol -priority 100 -gotoPriorityExpression NEXT -type REQUEST

Issue/Introduction

This article describes how to add the X-Forwarded-For header as the first HTTP header in the request.