Skip to content

IpAddressQuestion & HostnameQuestion: Toolbox::getRemoteIpAddress() doesn't support reverse proxies #8

@landure

Description

@landure

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

GLPI Version

11.0.1

Plugin version

1.0

Bug description

IpAddressQuestion and HostnameQuestion use GLPI Toolbox::getRemoteIpAddress() to determine the user IP address.
It returns $_SERVER["REMOTE_ADDR"].

This is an issue when hosting GLPI behing a reverse proxy such as Traefik.
The correct value is this case is (as seen in GLPI's Auth.php):

 $ip = getenv("HTTP_X_FORWARDED_FOR") ?: getenv("REMOTE_ADDR");

Please add an option to customize the env value used to get the user IP address.
Or add an EnvironmentVariableQuestion feature to allow querying HTTP headers.

Thank you for you work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions