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

Reverse-proxy issues #182

Open
HugoTH85 opened this issue Feb 2, 2024 · 1 comment
Open

Reverse-proxy issues #182

HugoTH85 opened this issue Feb 2, 2024 · 1 comment

Comments

@HugoTH85
Copy link

HugoTH85 commented Feb 2, 2024

Hello,

I have some trouble with trying to use reverse-proxy with OpenNetAdmin. It seems like I cannot use this software like that.
More precisely, when I am using the reverse-proxy URL, I can't connect with a LDAP account, and admin account doesn't have any permissions. Moreover, I cannot see the data (VLAN_campus, VLAN, subnets, etc.).
It would come from the Response Cookie that the server formulates.
To me, it is linked with this lines :

if(PHP_VERSION_ID < 70300) {
      session_set_cookie_params($conf['cookie_life'], '/; samesite=Strict', NULL, $secure, true);
    } else {
      session_set_cookie_params([
        'lifetime' => $conf['cookie_life'],
        'path' => '/',
        'domain' => $_SERVER['SERVER_NAME'],
        'secure' => $secure,
        'httponly' => true,
        'samesite' => 'Strict'
      ]);
    }

in the ona/www/include/functions_general.inc.php file.

What are your opinions about that ?

@HugoTH85
Copy link
Author

HugoTH85 commented Mar 6, 2024

I have found the origin of this issue. It is directly linked with session parameters which are set up in the functions_general.inc.php file. (path : ./ona/www/include/functions_general.inc.php).
Here is the original part of the code I have modified (line 1260) :

if(PHP_VERSION_ID < 70300) {
      session_set_cookie_params($conf['cookie_life'], '/; samesite=Strict', NULL, $secure, true);
    } else {
      session_set_cookie_params([
        'lifetime' => $conf['cookie_life'],
        'path' => '/',
        'domain' => $_SERVER['SERVER_NAME'],
        'secure' => $secure,
        'httponly' => true,
        'samesite' => 'Strict'
      ]);
    }

You are using the $_SERVER['SERVER_NAME'] superglobal variable and it always returns the server URL even if you're requesting from the reverse-proxy URL. So I have remplaced it with $_SERVER['HTTP_HOST'] that returns the domain name that appears in the HTTP Request Header and now it works pretty well !
So here is the modified part of the code :

if(PHP_VERSION_ID < 70300) {
      session_set_cookie_params($conf['cookie_life'], '/; samesite=Strict', NULL, $secure, true);
    } else {
      session_set_cookie_params([
        'lifetime' => $conf['cookie_life'],
        'path' => '/',
        'domain' => $_SERVER['HTTP_HOST'],
        'secure' => $secure,
        'httponly' => true,
        'samesite' => 'Strict'
      ]);
    }

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

No branches or pull requests

1 participant