Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a port-share setup with OpenVPN and Apache over HTTPS which works nicely. However, in my Apache logs the requests are logged with the OpenVPN server IP, rather than the client's actual IP.

This makes any analysis of these logs useless, and I'd like to log the client's IP. How can I do that?

share|improve this question
up vote 2 down vote accepted

It doesn't look like this will be possible - the only way you'd be able to do this is if OpenVPN were to intercept your HTTP requests at layer 7, and insert a header (something like X-Forwarded-For) with the client's IP in the request. Then you could use a custom log format, or something like mod_rpaf to ensure that IP ended up in the logs.

There's no mention of this feature in the OpenVPN docs, and I suspect they're just passing the TCP connection straight on once it's clearly not an HTTP request. Your best bet is probably to bring up a second IP address on your server and split the services like that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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