0

I have a load balancing IP in front of 2 apache servers

On the backend servers I'm using Apache 2.4 with mod_remoteip enabled to retrieve the real client IP which is working so long as the request is sent over HTTP, if a request is sent over HTTPS the 'X-Forward-For' is omitted

Is there a way to easily retrieve this?

First thought is to get all requests over HTTP and then forward to HTTPS with the hope of preserving that header

LogFormat being used - LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

0

X-Forwarded-For is a request header so it's upt to the client connecting to add that header or not to the request.

Apache itself can add that header in a request if it acts a proxy.

So, if the header is not there, the original request does not include the header.

  • I don't have control over the actual loadbalancer unfortunately. Would it be possible to direct everyone to port 80 and then redirect them to 443 including this X-Forwarded-For header? – asdasdasdasd Oct 12 '17 at 8:48
  • I don't think so. – ezra-s Oct 13 '17 at 12:21

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.