1

I have a server connected to the internet through a Fortigate 40C. When my php code calls $_SERVER['REMOTE_ADDR'], it returns the ip address of the router (the fortigate) rather than the remote IP accessing the php script.

Why is this?

4

1 回答 1

1

Fortigate 有一个在策略上“启用 NAT”的选项,这并不意味着转换地址(无论如何它都会为你做),但确实意味着它会改变一些数据包,用网关 IP 替换远程 IP。

确保“启用 NAT”已禁用,并且$_SERVER['REMOTE_ADDR']将按预期工作。

于 2013-09-26T09:37:55.033 回答