Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve event source IP reporting #1456

Closed
kasparsd opened this issue Oct 9, 2023 · 1 comment · Fixed by #1459
Closed

Improve event source IP reporting #1456

kasparsd opened this issue Oct 9, 2023 · 1 comment · Fixed by #1459

Comments

@kasparsd
Copy link
Contributor

kasparsd commented Oct 9, 2023

Feature Request

Determining user's IP reliably is difficult when the web server is behind layers of proxies as the request is made by the intermediary on behalf of the client. Here is how various services pass the origin IP to the server:

There is no reliable way for the WP plugin or WP core to detect the client IP so it would be useful to offer a filter for the current logic here:

// Support proxy mode by checking the `X-Forwarded-For` header first.
$ip_address = wp_stream_filter_input( INPUT_SERVER, 'HTTP_X_FORWARDED_FOR', FILTER_VALIDATE_IP );
$ip_address = $ip_address ? $ip_address : wp_stream_filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP );
$this->ip_address = $ip_address;

@kasparsd
Copy link
Contributor Author

kasparsd commented Jan 9, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant