router icon indicating copy to clipboard operation
router copied to clipboard

Forward Client IP address

Open t-tiger opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe. Subgraph system needs to restrict with client IP address. I need to set x-forwarded-for header to retain the client IP through router.

Describe the solution you'd like Enable to set x-forwarded-for with remote address.

Describe alternatives you've considered N/A

Additional context N/A

t-tiger avatar Jan 07 '23 08:01 t-tiger

This might be possible to do today using Rhai script. Have you attempted to look at the information available to you in the Rhai scripting request context and see if you can pull out what you need?

Overall, we're a bit hesitant to just put this into x-forwarded-for since the Router isn't just an intermediary proxy in the traditional "forwarded for" sense (though it is certainly an intermediary host!).

abernix avatar Jan 16 '23 15:01 abernix

I just had a need to do this as well. We need our subgraphs to have access to the client's IP address, but the reuqests on our subgraph endpoints are populated with the router's IP instead.

According to the Request Interface, I don't see an request.ip or similarly available property. Is there a hidden one?

calvinl avatar Feb 13 '23 21:02 calvinl

@abernix Sorry to bug you but still wondering if this is possible, and if not, is it in the roadmap? If neither, I think I will have to look for another solution.

calvinl avatar Feb 23 '23 15:02 calvinl

A possible temporary solution might be putting nginx before apollo router, and configuring router to pass x-forwarded-for

nick4fake avatar Jul 02 '23 04:07 nick4fake

If you ok with it, I could try to add request.ip to rhai engine

kindermax avatar Jun 06 '24 07:06 kindermax