简体   繁体   中英

HTTP_X_FORWARDED_FOR shows both ipv6 AND ipv4

I'm working on a website, that needs to show extra info for certain ip addresses. I'm using $_SERVER['HTTP_X_FORWARDED_FOR'], since the server is in Docker.

The weird part is that a phpinfo() shows this:

$_SERVER['HTTP_X_FORWARDED_FOR']    ::ffff:172.17.28.1

It seems to me like it is both a ipv6 AND ipv4? (how is this possible?)

Now for the question - how can I fetch the ipv4 part?

Best regards - Lars

It was the HA proxy setting that allowed both ipv6 and ipv4.

This has now been changed to only ipv4 and now everybody is happy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM