Skip to content

[BUG]: Local IP may be returned by request->getClientAddress(true); #16777

Closed
@elcreator

Description

@elcreator

Describe the bug
According to the standard the first non-local address should be selected https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Forwarded-For#selecting_an_ip_address

According to the implementation the first address is selected

return explode(",", address)[0];

To Reproduce
Steps to reproduce the behavior:
Open the website with Phalcon through any proxy

echo $this->request->getClientAddress(true);

Actual behavior
Local IP may be returned

Expected behavior

Non-local IP should be returned

Metadata

Metadata

Assignees

No one assigned

    Labels

    5.0The issues we want to solve in the 5.0 releasebugA bug reportstatus: mediumMedium

    Type

    Projects

    Status

    Implemented

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions