Option to rely on Drupal core in detecting user IP address

Created on 26 September 2024, 8 months ago

Problem/Motivation

We do not have a header that contains actual IP address in $_SERVER, however Drupal::request()->getClientIp() returns a correct one.

Proposed resolution

Provide an option to rely on Drupal core in detecting user IP address.

Feature request
Status

Active

Version

4.0

Component

Code

Created by

🇨🇾Cyprus alex.bukach

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @alex.bukach
  • Issue was unassigned.
  • Status changed to Needs work 6 months ago
  • 🇷🇺Russia zniki.ru

    Thanks for your patch, can you please convert it to MR.
    And looks like your forget to update services.yml to add new argument, after adding new dependency.

  • 🇦🇺Australia darvanen Sydney, Australia

    Echoing #3.

    Also:

    +++ b/src/IPTools.php
    @@ -24,11 +33,13 @@ class IPTools implements IPToolsInterface {
    +      $ip_address = $this->requestStack->getCurrentRequest()->getClientIp();
    

    This kind of magic fallback might bring some users unstuck.
    If we're going to provide this option it needs to have an explicit opt-in on the settings page please, and tests.

Production build 0.71.5 2024