How does the Heroku routing layer (what I assume is effectively a reverse proxy) manage client IP addresses even as it rewrites them, and how much of this is specific just to Heroku vs other reverse proxies?
Background - I was trying to debug an internal IP-related issue with Django, when I found that self.request.META['REMOTE_ADDR']
in logs seemed to change whenever I redeployed the dyno. It seems reasonable to conclude the proxy is stripping out my client's IP address and inserting its own, before sending it to my Django app.
But the routing layer must be storing my 'real' client IP somewhere in a reliable way, since it has to actually make a connection with the client, right? Is it, say, encoded in a TCP segment somewhere? Is it, say persisted in a lookup table in the Heroku routing layer itself?