Announcement

#1 2022-05-03 13:38:34

pwgusr
Member
2022-04-19
7

Piwigo NG access issues when Piwigo 12 is behind reversed proxy

Hi,

So been struggling a bit to get Piwigo NG to upload photo to my setup (fresh installation) of Piwigo 12 which is behind an Apache reversed proxy setup (forwarding https) and clearly some additional tweaking is needed as part of Piwigo config to get the Piwigo NG Android to be able to upload since I noticed that it briefly showed error message (red text on black bg and initally I didn't take notice of it...): Http status error (401) which indicates http access error. So based on that the proxy forward the https request to the backend server which is setup with http and Piwigo doesn't respond correctly. For Wordpress I would have to had this little code snipe to get it to work correctly and something simliar is needed for Piwigo:

Code:

if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
        $_SERVER['REMOTE_ADDR'] = $list[0];
  }

What would be the correct code to insert to the Piwigo config to get it to work proper behind proxy?

Environment details:
Piwigo 12.2.0
Operating system: Linux
PHP: 7.4.28
MySQL: 5.5.5-10.5.12-MariaDB-0+deb11u1
Graphics Library: ImageMagick 6.9.11-60

Offline

 

#2 2022-05-03 15:26:21

pwgusr
Member
2022-04-19
7

Re: Piwigo NG access issues when Piwigo 12 is behind reversed proxy

And of course I found this [Github] Piwigo issue #982 which raises the issue including ref. to the config file which in the end includes proxy config settings but still doesn't do the trick for me:

Code:

// +-----------------------------------------------------------------------+
// | Proxy Settings                                                        |
// +-----------------------------------------------------------------------+

// If piwigo needs a http-proxy to connect to the internet, set this to true
$conf['use_proxy'] = true;

// Connection string of the proxy
$conf['proxy_server'] = 'piwigo.mydomain.org:443';

// If the http-proxy requires authentication, set username and password here
// e.g. username:password
$conf['proxy_auth'] = '';

I'm using the following Apache proxy settings:

Code:

  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / http://xx.xx.xx.xx/
  ProxyPassReverse / http://xx.xx.xx.xx/

  RequestHeader set X-Forwarded-Proto "https"
  RequestHeader set X-Forwarded-Port "443"

Last edited by pwgusr (2022-05-03 15:31:10)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact