Skip to content

Password reset link when behind reverse proxy #87

@popindavibe

Description

@popindavibe

Describe the bug

Since I upgraded to FusionDirectory 1.4, the password recovery link generated is now broken.
My instance is behind a reverse proxy, as such I do not enforce SSL awareness in the fusiondirectory.conf file.

It used to work just fine for many years, but since the upgrade the links are now in the form of `https://[my-domain]:80/[rest-of-link]
That, obviously, is a broken link.

To Reproduce
Steps to reproduce the behavior:

Have recovery tab active and configured, then ask for a recovery link from the login form.

Expected behavior
A working reset link in the form of https://[my-domain]/[rest-of-link]

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • PHP: php 7.4
  • PHP provenance: original Debian

Additional context
I implemented a workaround in In /usr/share/fusiondirectory/include/class_URL.inc, in the second part of the if
(($protocol == 'https') && ($port != '443') && ($port != '80'))

  /*! \brief Returns current page URL
   */
  public static function getPageURL ($queryString = FALSE): string
  {
    list($protocol, $host, $port) = static::gatherInfos();

    $pageURL = $protocol.'://'.$host;
    # 20240629 Fix: if https and port 80 (reverse proxy), do not create https://[...]:80
    if ((($protocol == 'http') && ($port != '80')) || (($protocol == 'https') && ($port != '443') && ($port != '80')))
{
      $pageURL .= ':'.$port;
    }
    if (!empty($_SERVER['REQUEST_URI']) && $queryString) {
      $pageURL .= $_SERVER['REQUEST_URI'];
    } elseif (!empty($_SERVER['PATH_INFO'])) {
      $pageURL .= $_SERVER['PATH_INFO'];
    } else {
      $pageURL .= $_SERVER['PHP_SELF'];
    }
return $pageURL;

}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions