ssl reverse proxy #859

Closed
opened 2026-10-05 00:21:16 +02:00 by adam · 22 comments
Owner

Hello,

In case of reverse proxy SSL, lot function doesn't work properly.
To fix it, I applied these change in ./include/functions_url.inc.php function get_absolute_root_url

Detect SSL :

    if (isset($_SERVER['HTTPS']) &&
      ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)))
    {
      $is_https = true;
      $url .= 'https://';
    }

to

    if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)) or ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
    {
      $is_https = true;
      $url .= 'https://';
    }

AND ignore port change in this case:


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


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

Regards,

Thomas.

Hello, In case of reverse proxy SSL, lot function doesn't work properly. To fix it, I applied these change in ./include/functions_url.inc.php function get_absolute_root_url Detect SSL : ``` if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1))) { $is_https = true; $url .= 'https://'; } ``` to ``` if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)) or ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) { $is_https = true; $url .= 'https://'; } ``` AND ignore port change in this case: ``` if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80) ||($is_https && $_SERVER['SERVER_PORT'] != 443)) { ``` ``` if ( ((!$is_https && $_SERVER['SERVER_PORT'] != 80) ||($is_https && $_SERVER['SERVER_PORT'] != 443)) && (!$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) { ``` Regards, Thomas. <!-- github-sync-id:413808899 -->
adam closed this issue 2026-10-05 00:21:16 +02:00
Author
Owner

I can confirm that this fixes the issues I am experiencing when hosting on one.com.

I can confirm that this fixes the issues I am experiencing when hosting on one.com. <!-- github-comment-id:467791089 -->
Author
Owner

@ThomasGsp, perhaps you should make a pull request for this?

@ThomasGsp, perhaps you should make a pull request for this? <!-- github-comment-id:467795209 -->
Author
Owner

Hi,

It's works, but this fix is not a clean solution.
Indeed, the header HTTP_X_FORWARDED_PROTO can be remove and in this case it can't be trusted.

My point of view:
You should remove all this mess and implement a new option in the config file to handle properly this case.

Something like:
$config-->ssl_proxy = 1;

Used in the majority of CMS.

Regards,

Thomas.

Hi, It's works, but this fix is not a clean solution. Indeed, the header HTTP_X_FORWARDED_PROTO can be remove and in this case it can't be trusted. My point of view: You should remove all this mess and implement a new option in the config file to handle properly this case. Something like: $config-->ssl_proxy = 1; Used in the majority of CMS. Regards, Thomas. <!-- github-comment-id:467800996 -->
Author
Owner

I can confirm that this patch helps to resolve issues with images not being displayed in the Piwigo Android App when served via HTTPS.

40,41c40
<     if (isset($_SERVER['HTTPS']) &&
<       ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)))
---
>     if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)) or ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
57,58c56,57
<       if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
<             ||($is_https && $_SERVER['SERVER_PORT'] != 443))
---
>       if ( ((!$is_https && $_SERVER['SERVER_PORT'] != 80)
>             ||($is_https && $_SERVER['SERVER_PORT'] != 443)) && (!$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))

I can confirm that this patch helps to resolve issues with images not being displayed in the Piwigo Android App when served via HTTPS. ```diff 40,41c40 < if (isset($_SERVER['HTTPS']) && < ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1))) --- > if (isset($_SERVER['HTTPS']) && ((strtolower($_SERVER['HTTPS']) == 'on') or ($_SERVER['HTTPS'] == 1)) or ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) 57,58c56,57 < if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80) < ||($is_https && $_SERVER['SERVER_PORT'] != 443)) --- > if ( ((!$is_https && $_SERVER['SERVER_PORT'] != 80) > ||($is_https && $_SERVER['SERVER_PORT'] != 443)) && (!$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ``` <!-- github-comment-id:631116354 -->
Author
Owner

Now there seems to be a pull reuqest regarding this issue. And also other earlier it seems...

This has also been an issue for quite a long time. First mentions about similar issue are from year 2012
in the forums.
edit: tidied links and added note about other pull req´s

Now there seems to be a [pull reuqest](https://github.com/Piwigo/Piwigo/pull/1274) regarding this issue. And also other earlier it seems... This has also been an issue for quite a long time. First mentions about similar issue are from year 2012 [in the forums](https://piwigo.org/forum/viewtopic.php?id=19353). edit: tidied links and added note about other pull req´s <!-- github-comment-id:772281380 -->
Author
Owner

in case of header X-Forwarded-Host is set, function get_absolute_root_url will not take care of ports.
see https://github.com/Piwigo/Piwigo/blob/86c561156203870b2c07ad9e4a954098c1d69cc2/include/functions_url.inc.php#L50

e.g. for nginx just add to your proxy location:
proxy_set_header X-Forwarded-Host $http_host;

see also #681, #1128

in case of header X-Forwarded-Host is set, function get_absolute_root_url will not take care of ports. see https://github.com/Piwigo/Piwigo/blob/86c561156203870b2c07ad9e4a954098c1d69cc2/include/functions_url.inc.php#L50 e.g. for nginx just add to your proxy location: `proxy_set_header X-Forwarded-Host $http_host;` see also #681, #1128 <!-- github-comment-id:774499488 -->
Author
Owner

I asked my hosting provider to look for a solution to this case. They moved my website to another environment where the backend server uses port 443 with some other changes. This solved the issue in my case.

I asked my hosting provider to look for a solution to this case. They moved my website to another environment where the backend server uses port 443 with some other changes. This solved the issue in my case. <!-- github-comment-id:774651948 -->
Author
Owner

For those not wanting to patch their piwigo installation you can also add the following lines to local/config/config.inc.php using the local files editor plugin:

// Support X-Forwarded-Proto header for HTTPS detection in PHP
// Also need to set port correctly
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = '443';
}
For those not wanting to patch their piwigo installation you can also add the following lines to `local/config/config.inc.php` using the local files editor plugin: ``` php // Support X-Forwarded-Proto header for HTTPS detection in PHP // Also need to set port correctly if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = '443'; } ``` <!-- github-comment-id:986004313 -->
Author
Owner
// Support X-Forwarded-Proto header for HTTPS detection in PHP
// Also need to set port correctly
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
    $_SERVER['HTTPS'] = 'on';
    $_SERVER['SERVER_PORT'] = '443';
}

Hey! iis it possible to merge it? It solved my issues using batch manager under Nginx Proxy Manager :)

> ``` > // Support X-Forwarded-Proto header for HTTPS detection in PHP > // Also need to set port correctly > if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { > $_SERVER['HTTPS'] = 'on'; > $_SERVER['SERVER_PORT'] = '443'; > } > ``` Hey! iis it possible to merge it? It solved my issues using batch manager under Nginx Proxy Manager :) <!-- github-comment-id:1256078845 -->
Author
Owner

Is it really relevant to add $_SERVER['SERVER_PORT'] = '443'; ?

Is it really relevant to add `$_SERVER['SERVER_PORT'] = '443';` ? <!-- github-comment-id:1256104893 -->
Author
Owner

@ThomasGsp

My point of view: You should remove all this mess and implement a new option in the config file to handle properly this case.

Something like: $config-->ssl_proxy = 1;

And that would do what? Being behind a proxy doesn't imply an https URL.

@ThomasGsp > My point of view: You should remove all this mess and implement a new option in the config file to handle properly this case. > > Something like: $config-->ssl_proxy = 1; And that would do what? Being behind a proxy doesn't imply an `https` URL. <!-- github-comment-id:1256122976 -->
Author
Owner

I've made a first commit https://github.com/Piwigo/Piwigo/commit/2e037205ffae545b324c4cbcdac1c986db1ba6e5

For me, adding the $_SERVER['SERVER_PORT'] = '443'; is not necessary. Unless someone can explain me how it would be :-)

I've made a first commit https://github.com/Piwigo/Piwigo/commit/2e037205ffae545b324c4cbcdac1c986db1ba6e5 For me, adding the `$_SERVER['SERVER_PORT'] = '443';` is not necessary. Unless someone can explain me how it would be :-) <!-- github-comment-id:1256131894 -->
Author
Owner

@hardwareadictos I close this issue. If the SERVER_PORT is a problem, please open a new issue :-)

@hardwareadictos I close this issue. If the `SERVER_PORT` is a problem, please open a new issue :-) <!-- github-comment-id:1257879545 -->
Author
Owner

I'm on Piwigo 13.1.0, where I believe the commit 2e03720 is included, but I still have problems uploading behind a reverse proxy. Using Docker and Traefik. The file uploads, but the form does not return ok. The progress bar gets stuck at 100%. Output from the javascript console:

19rusqw.js:130 POST https://foto.vanhoucke.nl/ws.php?method=pwg.images.upload&format=json 504
send @ 19rusqw.js:130
exec @ 19rusqw.js:129
shimExec @ 19rusqw.js:129
exec @ 19rusqw.js:129
r @ 19rusqw.js:130
u @ 19rusqw.js:130
send @ 19rusqw.js:130
p @ 19rusqw.js:144
k @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
g @ 19rusqw.js:144
start @ 19rusqw.js:144
(anonymous) @ admin.php?page=photos_add:402
dispatch @ jquery.min.js?v13.1.0:4
r.handle @ jquery.min.js?v13.1.0:4

VM136:1 Uncaught SyntaxError: Unexpected token '<', "<html>
<h"... is not valid JSON
at JSON.parse ()
at m.parseJSON (jquery.min.js?v13.1.0:5:15998)
at o.Uploader.Error (admin.php?page=photos_add:576:40)
at o.Uploader. (19rusqw.js:144:14560)
at Array. (19rusqw.js:129:20062)
at i (19rusqw.js:129:3482)
at 19rusqw.js:129:3505
at Array. (19rusqw.js:129:20055)
at i (19rusqw.js:129:3482)
at 19rusqw.js:129:3505
m.parseJSON @ jquery.min.js?v13.1.0:5
Error @ admin.php?page=photos_add:576
(anonymous) @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
h @ 19rusqw.js:144
m.onload @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:130
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:130
load (async)
send @ 19rusqw.js:130
exec @ 19rusqw.js:129
shimExec @ 19rusqw.js:129
exec @ 19rusqw.js:129
r @ 19rusqw.js:130
u @ 19rusqw.js:130
send @ 19rusqw.js:130
p @ 19rusqw.js:144
k @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
g @ 19rusqw.js:144
start @ 19rusqw.js:144
(anonymous) @ admin.php?page=photos_add:402
dispatch @ jquery.min.js?v13.1.0:4
r.handle @ jquery.min.js?v13.1.0:4
admin.php?page=photos_add:595 Uncaught TypeError: Cannot read properties of null (reading 'id')
at o.Uploader.UploadComplete (admin.php?page=photos_add:595:43)
at o.Uploader. (19rusqw.js:144:14560)
at Array. (19rusqw.js:129:20062)
at i (19rusqw.js:129:3482)
at Object.r [as inSeries] (19rusqw.js:129:3589)
at o.Uploader.dispatchEvent (19rusqw.js:129:20101)
at o.Uploader.trigger (19rusqw.js:129:20386)
at o.Uploader.g (19rusqw.js:144:3868)
at 19rusqw.js:144:11385
UploadComplete @ admin.php?page=photos_add:595
(anonymous) @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
g @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:144
setTimeout (async)
_ @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
h @ 19rusqw.js:144
m.onload @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:130
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:130
load (async)
send @ 19rusqw.js:130
exec @ 19rusqw.js:129
shimExec @ 19rusqw.js:129
exec @ 19rusqw.js:129
r @ 19rusqw.js:130
u @ 19rusqw.js:130
send @ 19rusqw.js:130
p @ 19rusqw.js:144
k @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:144
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
(anonymous) @ 19rusqw.js:129
i @ 19rusqw.js:129
r @ 19rusqw.js:129
dispatchEvent @ 19rusqw.js:129
trigger @ 19rusqw.js:129
g @ 19rusqw.js:144
start @ 19rusqw.js:144
(anonymous) @ admin.php?page=photos_add:402
dispatch @ jquery.min.js?v13.1.0:4
r.handle @ jquery.min.js?v13.1.0:4

I'm on Piwigo 13.1.0, where I believe the commit 2e03720 is included, but I still have problems uploading behind a reverse proxy. Using Docker and Traefik. The file uploads, but the form does not return ok. The progress bar gets stuck at 100%. Output from the javascript console: 19rusqw.js:130 POST https://foto.vanhoucke.nl/ws.php?method=pwg.images.upload&format=json 504 send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4 VM136:1 Uncaught SyntaxError: Unexpected token '<', "<html> <h"... is not valid JSON at JSON.parse (<anonymous>) at m.parseJSON (jquery.min.js?v13.1.0:5:15998) at o.Uploader.Error (admin.php?page=photos_add:576:40) at o.Uploader.<anonymous> (19rusqw.js:144:14560) at Array.<anonymous> (19rusqw.js:129:20062) at i (19rusqw.js:129:3482) at 19rusqw.js:129:3505 at Array.<anonymous> (19rusqw.js:129:20055) at i (19rusqw.js:129:3482) at 19rusqw.js:129:3505 m.parseJSON @ jquery.min.js?v13.1.0:5 Error @ admin.php?page=photos_add:576 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 h @ 19rusqw.js:144 m.onload @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 load (async) send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4 admin.php?page=photos_add:595 Uncaught TypeError: Cannot read properties of null (reading 'id') at o.Uploader.UploadComplete (admin.php?page=photos_add:595:43) at o.Uploader.<anonymous> (19rusqw.js:144:14560) at Array.<anonymous> (19rusqw.js:129:20062) at i (19rusqw.js:129:3482) at Object.r [as inSeries] (19rusqw.js:129:3589) at o.Uploader.dispatchEvent (19rusqw.js:129:20101) at o.Uploader.trigger (19rusqw.js:129:20386) at o.Uploader.g (19rusqw.js:144:3868) at 19rusqw.js:144:11385 UploadComplete @ admin.php?page=photos_add:595 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 setTimeout (async) _ @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 h @ 19rusqw.js:144 m.onload @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 load (async) send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4 <!-- github-comment-id:1288140749 -->
Author
Owner

I'm on Piwigo 13.1.0, where I believe the commit 2e03720 is included, but I still have problems uploading behind a reverse proxy. Using Docker and Traefik. The file uploads, but the form does not return ok. The progress bar gets stuck at 100%. Output from the javascript console:

19rusqw.js:130 POST https://foto.vanhoucke.nl/ws.php?method=pwg.images.upload&format=json 504 send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4

VM136:1 Uncaught SyntaxError: Unexpected token '<', " <h"... is not valid JSON at JSON.parse () at m.parseJSON (jquery.min.js?v13.1.0:5:15998) at o.Uploader.Error (admin.php?page=photos_add:576:40) at o.Uploader. (19rusqw.js:144:14560) at Array. (19rusqw.js:129:20062) at i (19rusqw.js:129:3482) at 19rusqw.js:129:3505 at Array. (19rusqw.js:129:20055) at i (19rusqw.js:129:3482) at 19rusqw.js:129:3505 m.parseJSON @ jquery.min.js?v13.1.0:5 Error @ admin.php?page=photos_add:576 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 h @ 19rusqw.js:144 m.onload @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 load (async) send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4 admin.php?page=photos_add:595 Uncaught TypeError: Cannot read properties of null (reading 'id') at o.Uploader.UploadComplete (admin.php?page=photos_add:595:43) at o.Uploader. (19rusqw.js:144:14560) at Array. (19rusqw.js:129:20062) at i (19rusqw.js:129:3482) at Object.r [as inSeries] (19rusqw.js:129:3589) at o.Uploader.dispatchEvent (19rusqw.js:129:20101) at o.Uploader.trigger (19rusqw.js:129:20386) at o.Uploader.g (19rusqw.js:144:3868) at 19rusqw.js:144:11385 UploadComplete @ admin.php?page=photos_add:595 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 setTimeout (async) _ @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 h @ 19rusqw.js:144 m.onload @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 load (async) send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4

Agree... Having the same issue on v12... It ends up with a yellow triangle on the upload frontend...

> I'm on Piwigo 13.1.0, where I believe the commit [2e03720](https://github.com/Piwigo/Piwigo/commit/2e037205ffae545b324c4cbcdac1c986db1ba6e5) is included, but I still have problems uploading behind a reverse proxy. Using Docker and Traefik. The file uploads, but the form does not return ok. The progress bar gets stuck at 100%. Output from the javascript console: > > 19rusqw.js:130 POST https://foto.vanhoucke.nl/ws.php?method=pwg.images.upload&format=json 504 send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4 > > VM136:1 Uncaught SyntaxError: Unexpected token '<', " <h"... is not valid JSON at JSON.parse () at m.parseJSON (jquery.min.js?v13.1.0:5:15998) at o.Uploader.Error (admin.php?page=photos_add:576:40) at o.Uploader. (19rusqw.js:144:14560) at Array. (19rusqw.js:129:20062) at i (19rusqw.js:129:3482) at 19rusqw.js:129:3505 at Array. (19rusqw.js:129:20055) at i (19rusqw.js:129:3482) at 19rusqw.js:129:3505 m.parseJSON @ jquery.min.js?v13.1.0:5 Error @ admin.php?page=photos_add:576 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 h @ 19rusqw.js:144 m.onload @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 load (async) send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4 admin.php?page=photos_add:595 Uncaught TypeError: Cannot read properties of null (reading 'id') at o.Uploader.UploadComplete (admin.php?page=photos_add:595:43) at o.Uploader. (19rusqw.js:144:14560) at Array. (19rusqw.js:129:20062) at i (19rusqw.js:129:3482) at Object.r [as inSeries] (19rusqw.js:129:3589) at o.Uploader.dispatchEvent (19rusqw.js:129:20101) at o.Uploader.trigger (19rusqw.js:129:20386) at o.Uploader.g (19rusqw.js:144:3868) at 19rusqw.js:144:11385 UploadComplete @ admin.php?page=photos_add:595 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 setTimeout (async) _ @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 h @ 19rusqw.js:144 m.onload @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:130 load (async) send @ 19rusqw.js:130 exec @ 19rusqw.js:129 shimExec @ 19rusqw.js:129 exec @ 19rusqw.js:129 r @ 19rusqw.js:130 u @ 19rusqw.js:130 send @ 19rusqw.js:130 p @ 19rusqw.js:144 k @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:144 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 (anonymous) @ 19rusqw.js:129 i @ 19rusqw.js:129 r @ 19rusqw.js:129 dispatchEvent @ 19rusqw.js:129 trigger @ 19rusqw.js:129 g @ 19rusqw.js:144 start @ 19rusqw.js:144 (anonymous) @ admin.php?page=photos_add:402 dispatch @ jquery.min.js?v13.1.0:4 r.handle @ jquery.min.js?v13.1.0:4 Agree... Having the same issue on v12... It ends up with a yellow triangle on the upload frontend... <!-- github-comment-id:1288143738 -->
Author
Owner

@plegall
I've made a first commit 2e03720

For me, adding the $_SERVER['SERVER_PORT'] = '443'; is not necessary. Unless someone can explain me how it would be :-)

I think I can explain:
It is necessary if HTTP_X_FORWARDED_HOST is not set. In this case, the section that appends a port to the url (couple lines below) gets triggered, because of the condition ($is_https && $_SERVER['SERVER_PORT'] != 443).
Your patch changes to https, but piwigo behind reverse proxy might still see a connection on port 80.
The result is some requests erroneously going to https://hostname:80.

There are several possible fixes (I personally prefer 1.):

  1. Remove the section
if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80)
            ||($is_https && $_SERVER['SERVER_PORT'] != 443))
      {
        $url_port = ':'.$_SERVER['SERVER_PORT'];
        if (strrchr($url, ':') != $url_port)
        {
          $url .= $url_port;
        }
      }

entirely.
I think it facilitates HTTPS over port 80, and I don't know why you (anyone?) would want to support this.
In fact, I found the last commit message for these lines quite misleading (https://github.com/Piwigo/Piwigo/commit/6d01f33d9fa973c6209c1e6350aeea429b4c31b9), as for me it does the opposite.
Maybe should go along with a refactor of functions_url.inc.php, looking at the number of issues and PRs regarding this file (https://github.com/Piwigo/Piwigo/issues/681, https://github.com/Piwigo/Piwigo/issues/1128, https://github.com/Piwigo/Piwigo/pull/483, https://github.com/Piwigo/Piwigo/pull/1637, https://github.com/Piwigo/Piwigo/pull/1376).
2. Do as OP did in his last code block, use

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

Last part is important: skipping if HTTP_X_FORWARDED_PROTO is set. The same fix is also already present in https://github.com/Piwigo/Piwigo/pull/1376.
3. Do the assignment $_SERVER['SERVER_PORT'] = '443';. Feels a little hacky though.
4. Supposedly, you could also make your reverse proxy set HTTP_X_FORWARDED_HOST, as this also should disable the problematic section. This seems to be not without issues, however; see https://github.com/Piwigo/Piwigo/issues/1678.


@plegall
@hardwareadictos I close this issue. If the SERVER_PORT is a problem, please open a new issue :-)

I think I'm only pointing out symptoms – I don't really know what the core issue is.
Maybe 4. is the way to go. Maybe the right way forward is a refactor of functions_url.inc.php like mentioned in 1.
@plegall what do you think?

> @plegall > I've made a first commit [2e03720](https://github.com/Piwigo/Piwigo/commit/2e037205ffae545b324c4cbcdac1c986db1ba6e5) > > For me, adding the `$_SERVER['SERVER_PORT'] = '443';` is not necessary. Unless someone can explain me how it would be :-) **I think I can explain:** It is necessary if `HTTP_X_FORWARDED_HOST` is not set. In this case, the section that appends a port to the url (couple lines below) gets triggered, because of the condition `($is_https && $_SERVER['SERVER_PORT'] != 443)`. Your patch changes to https, but piwigo behind reverse proxy might still see a connection on port 80. The result is some requests erroneously going to `https://hostname:80`. There are several possible fixes (I personally prefer 1.): 1. Remove the section ``` if ( (!$is_https && $_SERVER['SERVER_PORT'] != 80) ||($is_https && $_SERVER['SERVER_PORT'] != 443)) { $url_port = ':'.$_SERVER['SERVER_PORT']; if (strrchr($url, ':') != $url_port) { $url .= $url_port; } } ``` entirely. I think it facilitates HTTPS over port 80, and I don't know why you (anyone?) would want to support this. In fact, I found the last commit message for these lines quite misleading (https://github.com/Piwigo/Piwigo/commit/6d01f33d9fa973c6209c1e6350aeea429b4c31b9), as for me it does the opposite. Maybe should go along with a refactor of `functions_url.inc.php`, looking at the number of issues and PRs regarding this file (https://github.com/Piwigo/Piwigo/issues/681, https://github.com/Piwigo/Piwigo/issues/1128, https://github.com/Piwigo/Piwigo/pull/483, https://github.com/Piwigo/Piwigo/pull/1637, https://github.com/Piwigo/Piwigo/pull/1376). 2. Do as OP did in his last code block, use ``` if ( ((!$is_https && $_SERVER['SERVER_PORT'] != 80) ||($is_https && $_SERVER['SERVER_PORT'] != 443)) && (!$_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) { ``` Last part is important: skipping if `HTTP_X_FORWARDED_PROTO` is set. The same fix is also already present in https://github.com/Piwigo/Piwigo/pull/1376. 3. Do the assignment `$_SERVER['SERVER_PORT'] = '443';`. Feels a little hacky though. 4. Supposedly, you could also make your reverse proxy set `HTTP_X_FORWARDED_HOST`, as this also should disable the problematic section. This seems to be not without issues, however; see https://github.com/Piwigo/Piwigo/issues/1678. ----- > @plegall > @hardwareadictos I close this issue. If the `SERVER_PORT` is a problem, please open a new issue :-) I think I'm only pointing out symptoms – I don't really know what the core issue is. Maybe 4. is the way to go. Maybe the right way forward is a refactor of `functions_url.inc.php` like mentioned in 1. @plegall what do you think? <!-- github-comment-id:1317755313 -->
Author
Owner

Hello,

Made several tests regarding this issue, following the advices of the tech people from my webhoster.

It appears that, at least for us, Piwigo is not detecting properly the reverse proxy used by the infrastructure of my webhoster.

Patch 2e03720, already included in V13.1, did not prove enough. I add to apply the solution mentioned above to get things working properly, including:

  1. thumbnails in the OpenStreetMap plugin
  2. photo display in the Piwigo NG android application

If I remove the LocalFile Editor trick mentioned above, then these two problems reappears.

Upgrading to Piwigo 13.2 is not enough. Reapplying the LocalFile Editor trick then fixes the two problems again.

Hope this helps,
Nicolas

Hello, Made several tests regarding this issue, following the advices of the tech people from my webhoster. It appears that, at least for us, Piwigo is not detecting properly the reverse proxy used by the infrastructure of my webhoster. Patch [2e03720](https://github.com/Piwigo/Piwigo/commit/2e037205ffae545b324c4cbcdac1c986db1ba6e5), already included in V13.1, did not prove enough. I add to apply the solution mentioned [above](https://github.com/Piwigo/Piwigo/issues/982#issuecomment-986004313) to get things working properly, including: 1. thumbnails in the OpenStreetMap plugin 2. photo display in the Piwigo NG android application If I remove the LocalFile Editor trick mentioned [above](https://github.com/Piwigo/Piwigo/issues/982#issuecomment-986004313), then these two problems reappears. Upgrading to Piwigo 13.2 is not enough. Reapplying the LocalFile Editor trick then fixes the two problems again. Hope this helps, Nicolas <!-- github-comment-id:1320917503 -->
Author
Owner

I'm on Piwigo 13.2 and can confirm the solution mentioned above does work! Thanks!

I'm on Piwigo 13.2 and can confirm the solution mentioned [above](https://github.com/Piwigo/Piwigo/issues/982#issuecomment-986004313) does work! Thanks! <!-- github-comment-id:1328028793 -->
Author
Owner
See https://github.com/Piwigo/Piwigo/commit/00480ce0a715412565d218ccf16406673f923a42 <!-- github-comment-id:1367586445 -->
Author
Owner

I also has this issue. Has tried the X-Forwarded-Proto + X-Forwarded-Host.

Added this to config.inc.php
// Support X-Forwarded-Proto header for HTTPS detection in PHP
// Also need to set port correctly
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = '443';
}

Running linuxserver/piwigo:13.4.0 and Traefik 1.6 on docker.

  • traefik.frontend.headers.customRequestHeaders=X-Forwarded-Proto:https||X-Forwarded-Host:piwigo.example.com

Also tried to use HTTPS between Traefik and piwigo, still the same issue. Docker port forwarding works without any issue.

Sill not possible to upload photos without that yellow triangle

I also has this issue. Has tried the X-Forwarded-Proto + X-Forwarded-Host. Added this to config.inc.php // Support X-Forwarded-Proto header for HTTPS detection in PHP // Also need to set port correctly if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = '443'; } Running linuxserver/piwigo:13.4.0 and Traefik 1.6 on docker. - traefik.frontend.headers.customRequestHeaders=X-Forwarded-Proto:https||X-Forwarded-Host:piwigo.example.com Also tried to use HTTPS between Traefik and piwigo, still the same issue. Docker port forwarding works without any issue. Sill not possible to upload photos without that yellow triangle <!-- github-comment-id:1368490096 -->
Author
Owner

I also has this issue. Has tried the X-Forwarded-Proto + X-Forwarded-Host.

Added this to config.inc.php // Support X-Forwarded-Proto header for HTTPS detection in PHP // Also need to set port correctly if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = '443'; }

Running linuxserver/piwigo:13.4.0 and Traefik 1.6 on docker.

  • traefik.frontend.headers.customRequestHeaders=X-Forwarded-Proto:https||X-Forwarded-Host:piwigo.example.com

Also tried to use HTTPS between Traefik and piwigo, still the same issue. Docker port forwarding works without any issue.

Sill not possible to upload photos without that yellow triangle

Having the same issue with Piwigo 13, was working fine with Nginx Proxy Manager till i updated... This workaround was working fine till now:

// Support X-Forwarded-Proto header for HTTPS detection in PHP
// Also need to set port correctly
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { 
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = '443';
}
> I also has this issue. Has tried the X-Forwarded-Proto + X-Forwarded-Host. > > Added this to config.inc.php // Support X-Forwarded-Proto header for HTTPS detection in PHP // Also need to set port correctly if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = '443'; } > > Running linuxserver/piwigo:13.4.0 and Traefik 1.6 on docker. > > * traefik.frontend.headers.customRequestHeaders=X-Forwarded-Proto:https||X-Forwarded-Host:piwigo.example.com > > Also tried to use HTTPS between Traefik and piwigo, still the same issue. Docker port forwarding works without any issue. > > Sill not possible to upload photos without that yellow triangle Having the same issue with Piwigo 13, was working fine with Nginx Proxy Manager till i updated... This workaround was working fine till now: ``` // Support X-Forwarded-Proto header for HTTPS detection in PHP // Also need to set port correctly if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) { $_SERVER['HTTPS'] = 'on'; $_SERVER['SERVER_PORT'] = '443'; } ``` <!-- github-comment-id:1592918339 -->
Author
Owner

I think i have your solution for this issue.

Upload php reference it self with FQDN, but the container does not resolve that correctly

I have added this to my docker-compose file (with my FQDN ofc).

extra_hosts:
  - "piwigo.example.com:127.0.0.1"
> I think i have your solution for this issue. Upload php reference it self with FQDN, but the container does not resolve that correctly I have added this to my docker-compose file (with my FQDN ofc). extra_hosts: - "piwigo.example.com:127.0.0.1" <!-- github-comment-id:1596640477 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#859