1

I'd like to know if there is some way to add the Client remote IP on my Request Header from API Man.

I need to add a Simple Header Policy with a "X-Forwarded-For" containing the client remote ip.

My backend is getting the APIMan IP as remote client, but what I need get to client IP.

Renato Barros
  • 177
  • 3
  • 14

1 Answers1

1

You can create a custom policy plugin and override doApply method to set the Client IP from ApiRequest object to the custom header like below.

 apiRequest.getHeaders().put("X-Forwarded-For", apiRequest.getRemoteAddr());

And add the new custom policy plugin to your services. This is a simple tutorial to create plugin

ulab
  • 1,079
  • 3
  • 15
  • 45