Announcement

#1 2021-01-25 03:43:01

ckayfish
Member
2021-01-25
53

Can't upload with mobile theme nor iOS app

Hello Giants whose shoulders I stand on,

I am a new Piwigo user, but experienced sysadmin, web admin, and sometime programmer I'm very familiar with many LAMP stack utilities. I run all of my apps in Docker, and behind an nginx Reverse Proxy (RP) using lets encrypt certificates.

Originally I noticed it was trying to upload with HTTP, and I couldn't find anywhere to change this. In order to get uploading to work in the front end with the Community Plugin, I told my RP to perform a string replacement on the HTTP response changing all instances of "HTTP://" to "HTTPS://", so now the form is uploading using HTTPS. All is working well from desktop.

With the Smart Pocket (mobile) theme, the upload screen shows the template, but not the upload form so I can't even try to upload with it. I can view Desktop, which loads my default theme and can then upload. With the iOS app can I create Albums, but not upload files as an admin/webmaster or as a user.

I can completely bypass my proxy to access my gallery directly with http. When I do this, there is no change to the upload page with the Smart Pocket template (doesn't display the upload form), but the mobile app will upload successfully.

My questions are:

1) Can others confirm they see the same issue with the Smart Pocket theme, no upload form? Any idea why?

2) What can we do to have the iOS mobile app allow uploads when the website is behind an SSL protected RP?

Any feedback or questions is welcome

Environment

    Piwigo 11.1.0 Check for upgrade
    Operating system: Linux
    PHP: 7.3.26 (Show info) [2021-01-24 18:19:15]
    MySQL: 5.5.5-10.4.17-MariaDB-1:10.4.17+maria~bionic-log [2021-01-24 18:19:15]
    Graphics Library: ImageMagick 7.0.10-48


--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#2 2021-01-25 16:06:25

JaneKing
SPAMMER
2021-01-21
8

Re: Can't upload with mobile theme nor iOS app

"Actually I made more tests, and it seems SmartPocket theme is more smarter then GDthumb or Gthumb+
If you set Piwigo thumbnails size to ""648x216px"" and ""crop"" option is disabled, SmartPocket will not generate another derivatives but use the core derivative instead.
Custom size ""648x216_z_0x216"" will appear in the Piwigo derivatives list, but if you check the /_data/i/... they are no generated files with this name. Instead if ""filename-th.JPG"" not exist, they will be generated when SmartPocked albums are first accessed."

Offline

 

#3 2021-01-25 17:01:05

ckayfish
Member
2021-01-25
53

Re: Can't upload with mobile theme nor iOS app

@JaneKing, I’m not sure if your reply was intended to address any of my questions.


--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#4 2021-01-26 07:33:20

ckayfish
Member
2021-01-25
53

Re: Can't upload with mobile theme nor iOS app

My work around for now is to disable the Smart Pocket theme, and to not recommend use of the app. Bootstrap Darkroom is a decent enough mobile interface. I kinda like the app, so it's unforunate uploads aren't working with an SSL RP in front


--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#5 2021-01-27 21:38:24

geeksheikh
Member
2021-01-27
3

Re: Can't upload with mobile theme nor iOS app

Hi I have nearly the same set up as you and am having the same issues.

How did you do this? The community plugin keeps seeing my root url as http:// instead of https:// even though the entire app works (except uploads as users).
I told my RP to perform a string replacement on the HTTP response changing all instances of "HTTP://" to "HTTPS://"

I too have issues with thumbnails loading on the app via https. if I go to http, things seem to work more seemlessly. I am not having an issue uploading over https from my phone (using the android version though) but I cannot upload via the desktop.

I posted my RP conf below
## Version 2020/12/09
# make sure that your dns has a cname set for piwigo

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name photos.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth, fill in ldap details in ldap.conf
    #include /config/nginx/ldap.conf;

    # enable for Authelia
    #include /config/nginx/authelia-server.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable the next two lines for ldap auth
        #auth_request /auth;
        #error_page 401 =200 /ldaplogin;

        # enable for Authelia
        #include /config/nginx/authelia-location.conf;

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        #proxy_set_header Host $host;
        set $upstream_app piwigo;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
        #proxy_set_header X-Scheme https
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_redirect          http:// https://;
        proxy_buffering         on;
        sub_filter      http:// https://;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Last edited by geeksheikh (2021-01-27 21:41:15)

Offline

 

#6 2021-01-27 21:59:38

cryopad
Piwigo Team
Grenoble, France
2015-11-01
190

Re: Can't upload with mobile theme nor iOS app

Would this discussion be helpful?
[Github] nginx-proxy-manager issue #661

and this one:
https://help.poralix.com/articles/iphon … rrordomain

Last edited by cryopad (2021-01-27 22:02:34)


If you enjoy Piwigo for iOS…
➤ We would appreciate an AppStore review.
➤ Comments, suggestions ? Tell us on GitHub…
➤ Not yet available in your language ? Help us translate it…

Offline

 

#7 2021-01-27 23:09:24

geeksheikh
Member
2021-01-27
3

Re: Can't upload with mobile theme nor iOS app

This completely solved my web/desktop problems THANK YOU

I still cannot get images to load on my android device though. Strangely enough, I can upload images from the app.

I login as a regular user (non-admin), my albums just appear empty but if I click on a white box where a picture should be it just loads a black background.

Offline

 

#8 2021-01-27 23:58:34

ckayfish
Member
2021-01-25
53

Re: Can't upload with mobile theme nor iOS app

I just added these to the location for that site, in order replace all http links with https. Without "Accept-Encoding" it wasn't finding the string to replace, possibly it was gzipped, and without turning "sub_filter_once" off, it would only replace the first instance of the string.

It's unfortunate that we cant give the site a hull URL (including protocol), or at least specify the protocol

Code:

  proxy_set_header Accept-Encoding "";
  sub_filter_once  off;
  sub_filter       'http://'    'https://';

--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#9 2021-01-28 00:07:04

geeksheikh
Member
2021-01-27
3

Re: Can't upload with mobile theme nor iOS app

Thanks, yeah still same for me, I can upload through the web fine now but the mobile apps aren't able to display images.

Offline

 

#10 2021-01-29 03:15:26

ckayfish
Member
2021-01-25
53

Re: Can't upload with mobile theme nor iOS app

I've fixed the iOS app upload issue, as well as some mixed content errors. Basically API's calls are returning JSON that includes URLs that look like: "https:\/\/my.domain.net\/upload\/2021\/01\/28\/20210128170127-258ea3fb.jpg". There is no "http://" string in here, so now I'm replacing "http:" with "https:".

Also, content-type of the HTTP response is "text/plain; charset=utf-8", same as HTML, but for some reason is still wasn't working, so I added "  sub_filter_types *;"

Sample API call
https://my.domain.net/ws.php?format=jso … lable_desc

Here is what I added to the RP location for this website to get all references everywhere (that I've seen so far) to HTTP converted to HTTPS, now including API calls.

Code:

  proxy_set_header Accept-Encoding "";
  sub_filter_types *;
  sub_filter_once  off;
  sub_filter       'http:'    'https:';

There really should be a config key/value pair that lets us specify the full host including protocol, or at least the protocol. Until that happens, at least there is a work around that works.

Last edited by ckayfish (2021-01-29 05:15:09)


--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#11 2021-01-29 08:11:31

cryopad
Piwigo Team
Grenoble, France
2015-11-01
190

Re: Can't upload with mobile theme nor iOS app

Great. It’s good that you’ve found a workaround.

For information, the iOS app always uses the same scheme (htttp:// or https://) and path (mydomain.org/path/to/piwigo) for safety reasons, i.e. all API requests use the URL entered in the login page. The API methods send JSON data and expect a JSON response except when downloading thumbnails and images (direct download in the opened session).


If you enjoy Piwigo for iOS…
➤ We would appreciate an AppStore review.
➤ Comments, suggestions ? Tell us on GitHub…
➤ Not yet available in your language ? Help us translate it…

Offline

 

#12 2021-01-29 08:28:32

ckayfish
Member
2021-01-25
53

Re: Can't upload with mobile theme nor iOS app

@cryopad, yes, the request is with HTTPS, but the JSON response includes URLs with HTTP. Here is an example of a request and a response.

https://my.domain.net/ws.php?format=jso … lable_desc


{"stat":"ok","result":{"paging":{"page":0,"per_page":10,"count":10,"total_count":"142"},"images":[{"id":165,"width":4032,"height":3024,"hit":1,"file":"IMG_3273.JPG","name":null,"comment":null,"date_creation":"2020-07-18 16:44:44","date_available":"2021-01-28 22:39:07","page_url":"http:\/\/my.domain.net\/picture.php?\/165","element_url":"http:\/\/my.domain.net\/upload\/2021\/01\/28\/20210128223907-96c5d005.jpg","derivatives":{"square":{"url":"http:\/\/my.domain.net\/_data\/i\/upload\/2021\/01\/28\/20210128223907-96c5d005-sq.jpg","width":120,"height":120},"thumb":{"url":"http:\/\/my.domain.net\/_data\/i\/upload\/2021\/01\/28\/20210128223907-96c5d005-th.jpg","width":144,"height":108},"xsmall":{"url":"http:\/\/my.domain.net\/i.php?\/upload\/2021\/01\/28\/20210128223907-96c5d005-xs.jpg","width":432,"height":324},"small":{"url":"http:\/\/my.domain.net\/i.php?\/upload\/2021\/01\/28\/20210128223907-96c5d005-sm.jpg","width":576,"height":432},"medium":{"url":"http:\/\/my.domain.net\/_data\/i\/upload\/2021\/01\/28\/20210128223907-96c5d005-me.jpg","width":792,"height":594},"large":{"url":"http:\/\/my.domain.net\/i.php?\/upload\/2021\/01\/28\/20210128223907-96c5d005-la.jpg","width":1008,"height":756},"xlarge":{"url":"http:\/\/my.domain.net\/_data\/i\/upload\/2021\/01\/28\/20210128223907-96c5d005-


--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#13 2021-01-29 19:15:29

cryopad
Piwigo Team
Grenoble, France
2015-11-01
190

Re: Can't upload with mobile theme nor iOS app

Exact @ckayfish.
The response depends on the server configuration and a server accepting https requests should provide URLs using the same protocol.

The logic of the iOS app is as follows: It uses https by default if http:// or https:// is not entered at login, or adopts the one entered by the user. If the first https request fails, it proposes to try http and informs the user of potential risks. Once the protocol is adopted (http or https), all requests are then performed using this protocol even if the server replies URLs containing another scheme. The main path is also locked to avoid unexpected calls to the server.


If you enjoy Piwigo for iOS…
➤ We would appreciate an AppStore review.
➤ Comments, suggestions ? Tell us on GitHub…
➤ Not yet available in your language ? Help us translate it…

Offline

 

#14 2021-01-30 02:06:36

ckayfish
Member
2021-01-25
53

Re: Can't upload with mobile theme nor iOS app

@cryopad, which explains why it has issues when behind an SSL RP. Although I connect to https://my.gallery.com, the RP sends a request to piwigo at something like http://172.20.0.2:80, and sets the host header to my.gallery.com.


--- devOps engineer; sometimes coder. I make your apps run with 99.999% uptime ---

Offline

 

#15 2021-01-30 08:53:09

cryopad
Piwigo Team
Grenoble, France
2015-11-01
190

Re: Can't upload with mobile theme nor iOS app

Exact @ckayfish. It is not very safe to forward requests in http mode. Imagine that someone penetrates your LAN and sniff the traffic. A solution is to do re-encrypting. See for example https://reinout.vanrees.org/weblog/2017 … proxy.html.


If you enjoy Piwigo for iOS…
➤ We would appreciate an AppStore review.
➤ Comments, suggestions ? Tell us on GitHub…
➤ Not yet available in your language ? Help us translate it…

Offline

 

Board footer

Powered by FluxBB

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