Skip to content

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

Open
@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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions