I am totally new to aFlex so naturally, am totally lost.
I have a VIP that I want to capture the sources IP and Port number. I have some success with the following:
when HTTP\_REQUEST \{
HTTP::header insert "X-Forwarded-For" [IP::client\_addr]
\}
This gives me the IP but only if it is http, not https (http_request error). Anybody have any ideas on a aFlex script that will give me the IP and Port for both HTTP and HTTPS?
In my VIP I have 80 and 443 ServiceGroups defined. The SSL is hosted on the server, not A10. I’ve tried to use HTTP_REQUEST with the 443 port entry and always get an error that it can’t work. When I try, I get this: Warning: aFleX syntax error: line 1: “event is invalid for this virtual port [HTTP_REQUEST]”"
That is expected behaviour. You can only modify the request in HTTPS when the A10 terminates the connection. When it’s passing through the A10 it’s all encrypted until it reaches the server.
The aFleX event HTTP_REQUEST only works on VPORT types HTTP, HTTPS and most Fast-HTTP, it will not work for VPORT type TCP.
That actually makes sense. The X-Forwarded-For header is only supposed to have IP addresses and adding the port might cause this. What if you change the header to something else?
when HTTP_REQUEST { HTTP::header insert "X-Test-Client" [IP::client_addr]:[TCP::local_port] }
I changed the aFlex to your new script. We are not getting the error so as soon as we can do some testing I’ll let you know if this did the trick. Thanks!