A
A
Anatoly2017-09-09 21:05:14
Apache HTTP Server
Anatoly, 2017-09-09 21:05:14

How to determine the ip-address of the visitor if port 80 is forwarded through the router?

Through Mikrotik, I redirected port 80 to the LAN to the Web server.
How to find out the ip address of a web server visitor?
<?php
echo $_SERVER["REMOTE_ADDR"];
?>
Shows the local ip address of Mikrotik.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly, 2017-09-12
@Tolly

Issue resolved! Maybe someone is interested:
In Apache 2.4 on Windows, in order to see the remote ip-address behind NAT, you need to connect the module:
LoadModule remoteip_module modules/mod_remoteip.so
and write:

<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1 192.168.5.1
</IfModule>

list the ip addresses through a space, 127.0.0.1 is needed a priori, 192.168.5.1 is my internal ip address of Mikrotik.

L
Ltonid, 2017-09-10
@AtaZ

Set up Apache or nginx, Mikrotik does not delay external ip when dnat. At the very first, I also sinned on Mikrotik, but then I read it and set up the backend.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question