API IP Diversion
Was this helpful?
Was this helpful?
APIs registered in the system can be configured to allocate IP traffic and restrict access.
This application is similar to the concept of double centers. Using the concept of branch company for explanation, Taipei IPs need to use Taipei APIs, and Kaohsiung IPs need to use Kaohsiung APIs; setting it properly will make them easier to manage and prevent errors from being accidentally triggered.
Go to API Management > API Registry, and click CUSTOMIZE to enter the registration page.
Fill in the required fields: API Name, digiRunner Proxy Path and Http Methods.
Since authentication is not required for now, select No Auth.
After selecting Source IP diversion for the Target URL field, click on the + icon to get two Source IP input boxes.
Fill in the local IP for the first Source IP, and fill in the API address to call for the target URL.
Fill in the Custom IP for the first Source IP, and fill in the API address to call for the target URL.
Click Register to complete the API registration.
Select No Auth for Authorization.
Click Test to view the response. Since the local IP is defined in the Source IP, it is expected that the return code will be received successfully and be 200, and the Body contains the data defined by the API.
In the Key field of the Request Header, fill in X-Forwarded-For, and in the Value field, fill in the custom IP that matches the Source IP.
Click Test to view the response. Since the custom IP is defined in the Source IP, it is expected that the return code will be received successfully and be 200, and the Body contains the data defined by the API.
In the Key field of the Request Header, fill in X-Forwarded-For, and in the Value field, fill in a random custom IP.
Click Test to view the response. Since the IP is not defined in the Source IP, it is expected that the call will fail, the return code received will be 401, and the Body will respond "Missing srcUrl information
".
Go to API Management > API List, and select the API, the status light is red by default; click Enable.
A confirmation window will pop up, click Confirm to finish enabling the API, and the status light will turn green .
Click on the Test icon to open the testing area.