How to send the client IP address through a dedicated HTTP header
When a user makes a request to an application, the X-Forwarded-For
HTTP header stores the client IP. However, since edge nodes mediate requests to an edge application, the header also stores other addresses in the request route in addition to the client IP address.
To isolate the client IP, you must forward it to a new header by creating a rule using Rules Engine for Edge Application.
To send the original client IP through a new request header, follow these steps:
- Access Azion Console > Edge Application.
- Select the edge application you want to apply the solution to.
- Click the Rules Engine tab and select the Default Rule.
- In the Behavior section, click the + Add Behavior button.
- In the new behavior field, select Add Request Header.
- In the argument field, add the following string:
X-Client-IP:${remote_addr}
- Click the Save button.
After completing the alteration in Rules Engine, the IP address of the client that originated the request will be added to the X-Client-IP
header.
- Access Real-Time Manager.
- On the top-left corner of the page, go to Products menu, represented by the three horizontal lines, and under the BUILD section, select Edge Application.
- Select the edge application you want to apply the solution to.
- Click the Rules Engine tab > select the Default Rule.
- In the Behavior section, click the + button.
- In the new behavior field, select Add Request Header.
- In the argument field, add the following string:
X-Client-IP:${remote_addr}
- Click the Save button.
After completing the alteration in Rules Engine, the IP address of the client that originated the request will be added to the X-Client-IP
header.