UPDATE: IP forwarding code updated to make it
work with people behind proxies, as noted by Albert and Zillur in
the comments.

With this change your application will be able to get the
client IP and resolve correctly the country using GeoIP. When
your application needs the client IP you only have to access to
the header X-Forwareded-For.

But caution! If you ALWAYS want that header set in every request,
you need to add this:

sub vcl_pipe {
# Note that only the first request to the backend will have
# X-Forwarded-For set. If you use X-Forwarded-For and want to
# have it set for all requests, make sure to have:
# set bereq.http.connection = "close";
# here. It is not set by default as it might break some broken web
# applications, like IIS with NTLM authentication.
set bereq.http.connection = "close";
return (pipe);
}

Now, you might want to see the original IP in the apache
logs too. To do that you have to use a custom log that prints the
X-Forwareded-For header. Just add inside your
Virtualhost declaration:

You should also have in mind that this configuration is appended,
so it might happen that you vcl has already a line like this, so
you are doing it twice. See the commented code in the default.vcl
file.

The latest VCL file includes already the client.ip, just that it
might appear twice! Copy all the file and tune the lines you like