router
router copied to clipboard
Forward Client IP address
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
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!).
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?
@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.
A possible temporary solution might be putting nginx before apollo router, and configuring router to pass x-forwarded-for
If you ok with it, I could try to add request.ip to rhai engine