Krzysztof_Kozlo
Jul 20, 2006Nimbostratus
Fetching multiple headers
We are attempting to use Universal Persistence to work around source IP addresses being obscured by intervening infrastructure (i.e. proxy servers). The proxy servers in our environment insert an X-Forwarded-For header, as does the BigIP. Normally, the value of the header we wish to base universal persistence on is that of the first X-Forwarded-For.
However, the BigIP does not appear to allow you to fetch the first header using HTTP::header if a subsequent header appears. (Please don't tell me that the HTTP RFC does not permit multiple headers with the same field-name, the BigIP itself will create a new header if "Insert X-Forwarded-For" is enabled instead of appending to the existing header.)
I can't even fetch headers by index, which would allow me to iterate the header-names, increment a variable, and retrieve the header -- HTTP::header at n returns only the header name, not the header value.
The iRules quick reference seems to suggest that HTTP::request and HTTP::collect will somehow return the entire HTTP request, which would also do the job, but I can't get these working.
HTTP::collect
set x [HTTP::payload]
this returns null
HTTP::request doesn't even compile.
The only way I've found to get what I want so far is to TCP::collect when CLIENT_ACCEPTED and then parse the TCP::payload. There has to be a better way.
Incidentally I notice several others asked about how to get at the nth Set-Cookie or Accept header, and when the initial responses proved unhelpful or incomplete, the questions seemed to die on the vine. As I am often encouraged to search through or post my questions in DevCentral, I harbor some hope these are the exception rather than the norm.