standardnotes / self-hosted

[Legacy] Self-host your own Standard Notes server for end-to-end encrypted notes and files
https://github.com/standardnotes/server
GNU Affero General Public License v3.0
343 stars 39 forks source link

Files can't be viewed or downloaded on the mobile apps. #79

Open navjotjsingh opened 2 years ago

navjotjsingh commented 2 years ago

This issue seems to be persistent on both iOS and Android apps. It can even be replicated on the web app when accessed through the phone.

For the iOS app, the bug has already been documented. https://github.com/standardnotes/standalone/issues/73#issuecomment-1168667694

I can confirm that I am getting the same error when I try to view or download the file via the Android app.

Downloading gives me a 0-sized file. While trying to view it, I get the same error as reported in the link above.

Could not obtain content-range header while downloading.

The preview also shows me an empty file when I use the web app on my phone. And it looks like I can't even upload files from my phone.

BobWs commented 1 year ago

Still no solution in the latest version!

jonwsoto commented 1 year ago

you have to use a public facing url that Is setup with reverse proxy for the files url

then you need to add

proxy_cache off; to your reverse proxy config

BobWs commented 1 year ago

you have to use a public facing url that Is setup with reverse proxy for the files url

Sorry to bother you again, but I can't seem to get it to work.

I've added this FILES_SERVER_URL=https://files.mydomain.com to files.env rebuild the container but it still isn't working (for the mobile apps). If I go to https://files.mydomain.com in a browser I'm getting an error on the page Cannot GET /

I'm not sure how to setup the proxy_cache off; setting with reverse proxy. I'm using Ngnix Proxy Manager (NPM) as my reverse proxy on a Synology Nas.

Could you elaborate a bit more with examples and/or share a config file?

jonwsoto commented 1 year ago

Are you using bare metal install? I am using a docker for the NPM

I also get the error on the page Cannot GET / which I believe is just a 404 page and is normal.

Disclaimer I am by no means an expert on this but from what I gathered the only way to add header configs in NPM through the admin panel is under the custom locations. Here is a screenshot. The other way is digging into the config files and seemed more complex. I saved this screenshot when I was figuring this out I have no idea the source anymore…. I am not near my comp to screen shot mine so the headers in there are different than what I use anyways.

23F417E4-4608-4685-A232-C8ED77B8B5AF

Here is my block of headers that I have understood are helpful to harden your http requests

add_header Content-Security-Policy upgrade-insecure-requests; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Xss-Protection "1; mode=block" always; add_header X-Content-Type-Options "nosniff" always; add_header Permissions-Policy "interest-cohort=()" always; add_header Referrer-Policy "no-referrer" always; proxy_cache off;

as you can see the proxy cache one is at the very end.

Here is a site you can go to to test your domains security score

https://securityheaders.com/

If anyone else wants to chime in about the best headers to use to secure your server please do!!

edit You got me to review headers. Found this article, very interesting and reviews them nicely. I need to review mine lol.

https://www.validbot.com/info/security-headers.php

BobWs commented 1 year ago

Are you using bare metal install? I am using a docker for the NPM

Thanks for sharing! I’m also using NPM Docker. I will look at it and make the necessary changes and see if it works.

BobWs commented 1 year ago

Well I've tried but no joy! Still isn't working.

Now I got no error message but a popup that something is downloading but nothing else happens.

IMAGE-1

I think that somewhere something is not set right, but I have no idea what and where to look for it.

Thanks for your help so far.

jonwsoto commented 1 year ago

Check the developer tool under the app. And see console and under network. Any errors? I noticed larger photos for me took much longer and seemed to hang but did go through. Try a small file?

BobWs commented 1 year ago

Okay I give up for now since I can't get it to work!

I can upload and delete files (WiFi ios devices) but I cannot view them. With mobile data on (4G ios devices), I can't do anything at all, neither upload files nor view them.

I have also tried it with an Android device but it does not work there at all (WIFI and data 4G).

Standardnotes is really a mess for selfhost, there are 5000 containers to install and maintain. They regularly change something in the configuration and you have to find out where it is and how it works. Very frustrating.

I think I will switch to Joplin, where you have one server and one database.

dotbugfix commented 1 year ago

Changing the EXPOSED_FILES_PORT in the .env file to 80 made it work for me. Presumably the default was 3125 but the nginx-proxy-manager only listens on port 80. Removing :3125 from FILES_SERVER_URL is also necessary, but not enough.

BobWs commented 1 year ago

Changing the EXPOSED_FILES_PORT in the .env file to 80 made it work for me. Presumably the default was 3125 but the nginx-proxy-manager only listens on port 80. Removing :3125 from FILES_SERVER_URL is also necessary, but not enough.

Thanks for sharing! Unfortunately your suggestions didn't work for me. I can't change port 3125 to port 80 because port 80 is already in use. It is default reserved for DSM on my Synology NAS and blocked for other use. So that wouldn't work for me. Still I can upload and preview the files on my MacOS desktop app but not on any mobile devices.

And also after I updated to the latest version with using the latest:tag my uploaded files aren't saved into the upload folder anymore. I'm convinced that it was before the case when I used the version specific tag.

drapado commented 1 year ago

Interestingly, if you opt in for the "New mobile experience" in the android app, the file upload works. However, there's a size limit around 1-2 MB