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

Collections menu doesn't work behind a reverse proxy #23

Open
jameswyper opened this issue Dec 28, 2021 · 1 comment
Open

Collections menu doesn't work behind a reverse proxy #23

jameswyper opened this issue Dec 28, 2021 · 1 comment

Comments

@jameswyper
Copy link

Hi. I'm not completely sure if this is a problem with the plugin, with the general piwigo architecture or my configuration - but other plugins that alter the top menu (e.g. "Random Photo") work OK in my setup, which is:

Piwigo 12.1.0 / php 7.3.33 on Linux (arm64).
A docker container running nginx and listening with http on port 8081
A second docker container also running nginx listening on 443 / https and configured as a reverse proxy to the first one:

    location /photos {
        proxy_pass http://piwigo_nginx:8081/photos;
        proxy_set_header Host $host;
    }

My browser connects to the second container.

Almost everything works fine with this setup. The base piwigo functionality works, and I can add photos to collections by clicking on the star icon. In the plugin configuration I can delete the collections as well. However, the main "Collections" menu item and the options underneath (any existing collections / create a new collection) can't be navigated to because the URL includes port 8081

For now I've worked around this by changing my nginx configuration

    location /photos {
        proxy_pass http://piwigo_nginx:8081/photos;
        proxy_set_header Host $host;
        sub_filter_once off;
        sub_filter_types *;
        sub_filter <my domain>:8081 <my domain>;
    }

and maybe that's the correct solution but I thought I should report this in case it can (and should) be fixed in the code. Thank you.

@laurence2605
Copy link

laurence2605 commented Feb 28, 2024

Hello !!!
I encountered an issue 2 days ago that seems to be alike.

the support from my web hosting provider fixed the issue with those corrections
In the file "functions_url.inc.php" ...

 if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)) or ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))

instead of

if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)))

and

 if ( ((!$is_https && $_SERVER['SERVER_PORT'] != 80)
        ||($is_https && $_SERVER['SERVER_PORT'] != 443)) && (!$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))

instead of

  if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
        ||($is_https && $_SERVER['SERVER_PORT'] != 443))

Now, it works well for me!
I hope it will be usefull for your case.

My versions -----------
[Piwigo]: 12.1.0
PHP: 7.3.33
MySQL: 5.5.5-10.11.4-MariaDB
ImageMagick 6.9.11-60

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

2 participants