Skip to content

Sites Behind Cloudflare Proxy Give Proxy's IP Address in Emails Rather than the User's IP Address #800

@alexclst

Description

@alexclst

Describe the bug

In the 0.15.0 update pull request #728 adds the user's IP address to the email message. That code $_SERVER['REMOTE_ADDR'] to find the address. But for sites that sit behind Cloudflare's proxy that variable will return the proxy's IP address, not the user's. You can access the user's IP address from $_SERVER['HTTP_CF_CONNECTING_IP']. This message should be updated to check for that variable first, or filter the found IP address so we can separately add filters to check that variable.

Steps to Reproduce

  1. Run this plugin on a site that sits behind Cloudflare's proxy
  2. Trigger the email message about a login discussed in pull request #728
  3. Compare the IP address the generated email message has to your own
  4. Notice they differ

Screenshots, screen recording, code snippet

No response

Environment information

No response

Please confirm that you have searched existing issues in this repository.

Yes

Please confirm that you have tested with all plugins deactivated except Two-Factor.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions