Announcement

#1 2015-08-03 10:58:46

tomass
Member
New Zealand
2015-06-16
19

[resolved] Unable to gen. multiple size images - Piwigo behind rev. proxy & https

Greetings,
I ran into issues with batch manager, specifically with action Generate multiple size images. This never completes, always shows progress bar with 0/0 and no progress at all. I think it is similar to this post - http://piwigo.org/forum/viewtopic.php?id=23217

I am running Piwigo behind Nginx as a reverse proxy. I also redirect all http requests to https on Nginx level. Protocol between Nginx and Apache is http. Relevant Nginx config snippet:

Code:

  proxy_pass http://webserver;

  proxy_set_header   Host   $host;
  proxy_set_header   X-Real-IP  $remote_addr;
  proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header   X-Forwarded-Proto https;
  proxy_set_header   X-Forwarded-Ssl on;

I am not sure what else do I need to do in order to pass relevant information to Apache / Piwigo that the front URL has https protocol?
Any help would be much appreciated.
Cheers, Tomas

Piwigo version: 2.7.4
PHP version: 5.5.9-1ubuntu4.11
MySQL version: 5.7.7-rc
Piwigo URL: https://tomassobekphotography.co.nz/photos/

Offline

 

#2 2015-08-09 09:37:40

tomass
Member
New Zealand
2015-06-16
19

Re: [resolved] Unable to gen. multiple size images - Piwigo behind rev. proxy & https

I found another header to try and add while working on another https related issue:

Code:

proxy_set_header   Scheme $scheme;      # http/https

But that didn't help with anything. I found that I can however fix function get_absolute_root_url if I add following code to my local/config/config.inc.php:

Code:

if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
    $_SERVER['HTTPS']='on'; 
    $_SERVER['SERVER_PORT']=443;
}

That fixed my other https related issue but not this one. I also noticed in Chromium Inspect element function after a failed attempt to use the batch manager - generate multiple size images:

https://tomassobekphotography.co.nz/photos/ws.php?format=json&method=pwg.getMissingDerivatives
Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Checking URL https://tomassobekphotography.co.nz/pho … erivatives this returns some JSON formatted data without issues.

Looking in the Apache error log I can see two error messages from that time:

[Sun Aug 09 17:52:00.983571 2015] [:error] [pid 10] [client 192.168.1.10:55946] PHP Warning:  simplexml_load_file(https://localhost/photos/ws.php?format=rest&method=pwg.categories.getImages&per_page=1&order=random): failed to open stream: Connection refused in /var/www/html/header.php on line 129, referer: https://tomassobekphotography.co.nz/pho … ategory/34
[Sun Aug 09 17:52:00.983650 2015] [:error] [pid 10] [client 192.168.1.10:55946] PHP Warning:  simplexml_load_file(): I/O warning : failed to load external entity "https://localhost/photos/ws.php?format=rest&method=pwg.categories.getImages&per_page=1&order=random" in /var/www/html/header.php on line 129, referer: https://tomassobekphotography.co.nz/pho … ategory/34

So unless someone else comes with some bright idea, my next plan of attack is to figure out where is this https://localhost/ coming from. Alternatively I could try setting up SSL on the Apache server.

Offline

 

#3 2015-08-09 12:15:22

tomass
Member
New Zealand
2015-06-16
19

Re: [resolved] Unable to gen. multiple size images - Piwigo behind rev. proxy & https

I tried setting up SSL in Apache with a self-signed certificate for localhost. It didn't solve the issue though I stopped seeing error messages about https://localhost. I suppose I would need to put the certificate somewhere to use client-side and I have no idea where it might be.

Does anybody have an idea how to debug/trace the code of the batch manager function? I am not a developer and I am not sure where to start.

Offline

 

#4 2015-08-10 09:16:17

tomass
Member
New Zealand
2015-06-16
19

Re: [resolved] Unable to gen. multiple size images - Piwigo behind rev. proxy & https

Ok, so the last obstacle was my web application firewall. I managed to get it working now and hope my notes above might be helpful to others. Though there are limits on how many photos it will take. I ran successfully with 20 photos but 50 failed with: 400 bad request. I suppose this might be related to my WAF.

Offline

 

#5 2015-08-11 10:03:33

flop25
Piwigo Team
2006-07-06
6965

Re: [resolved] Unable to gen. multiple size images - Piwigo behind rev. proxy & https

thanks for sharing


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact