Uppy uploader crashes when using $tempdir on a Docker installation - reverse proxy

149 views
Skip to first unread message

Brian Irwin

unread,
Sep 9, 2022, 2:25:24 PM9/9/22
to ResourceSpace
Hello!

I have recently upgraded from 9.6 to 9.8 on my docker installation with reverse_proxy and have noticed a bug with the Uppy uploader when using $tempdir.  What happens is after the file is uploaded, the user is sent to the edit screen with "Preview Unavailable" and no files are uploaded to tmp or filestore.  It's like they get bounced back.   No error messages appear anywhere in the logs, chrome debugger, and RS log/console.

The permissions are correct on my $tempdir and I have even tried moving it from outside of root into /var/www/html/tmp etc...

I have also tried PHP 7.4, 8.0, and 8.1 and running a test with the latest trunk with the same results.

Uploads work fine when I don't use the $tempdir variable, files go into filestore directory as expected.  I'm pretty sure this is an issue with reverse_proxy, but I have been having a difficult time running it down. It's challenging to troubleshoot since there are no problems with Uppy when $tempdir is not being used.  

The $tempdir option is vital to my system since I have been using S3 as a mounted storage backend to the filestore directory for years.  It would be a huge performance hit without it.  

Has anyone else encountered this issue on a docker installation with reverse proxy? 

Thanks in advance for any insight.

Best Regards,

Brian

Brian Irwin

unread,
Sep 12, 2022, 5:44:33 PM9/12/22
to ResourceSpace
I've made some progress with this issue.  Uppy is still not working with the $tempdir set on 9.8, but I was able to fix an http header error on my 9.8 installation.  
(My RS install is running on an Apache docker container behind nginx proxy manager. )

In my apache vhost config (or htaccess) I needed to tell apache that the reverse proxy is serving the site using SSL:
As indicated in this gist: https://gist.github.com/nurtext/b6ac07ac7d8c372bc8eb

# Let apache know we're behind a SSL reverse proxy
SetEnvIf X-Forwarded-Proto "https" HTTPS=on

# Redirect to HTTPS
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IFModule>


There are numerous documented issues with Uppy and reverse proxy setups:  https://github.com/transloadit/uppy/issues/2304

I have been able to get $tempdir working with Uppy on 9.7, so I will proceed with that version until I can spend more time troubleshooting it on versions 9.8+
I'll be sure to post back with any updates!

Brian Irwin

unread,
Sep 14, 2022, 3:14:15 PM9/14/22
to ResourceSpace
Here's an update on my progress thus far :-)

The $tempdir variable continues to be an issue for me on versions 9.8 and 10.0 with the Uppy uploader. 
Files uploaded with Uppy do not make it into the filestore when $tempdir variable is set.  The user is redirected to the "Refine metadata" (edit.php) with the "Preview Unavailable" and no files etc..
I've double-checked folder permissions and have tried moving the tmp directory to different places /var/www/html/tmp, /var/tmp etc...

I also created several test installations on normal systems. (No docker or reverse proxy used)  One dedicated server, one digital ocean vm, and one linode vm.  All running PHP 8.1 Ubuntu 20.04.4 LTS, MariaDB-1:10.6.4. 
The issue continues to persist across all installations of 9.8 and 10.  No errors appear in the rs, php error logs.

RS version 9.7 is the only version I have been able to use with Uppy and the $tempdir variable set.  Has anything changed after 9.7 regarding how files are handled when $tempdir is set?

Given how many installs I have tested with this error, has anyone else encountered this issue yet?

I'll continue testing other environments and examine the code to see if it can be narrowed down to a specific version of PHP, Ubuntu/linux etc... 

I thought it was related to reverse proxy at first but that doesn't seem to matter.

I'll keep you posted!

Best Regards,

Brian

reidb...@gmail.com

unread,
Sep 15, 2022, 8:52:15 AM9/15/22
to ResourceSpace
I just installed my first 10.0 and am seeing the same issue with the $tempdir variable. I haven't yet dug into it, but coming from 9.7 $tempdir worked fine. 

Brian Irwin

unread,
Sep 15, 2022, 8:11:16 PM9/15/22
to ResourceSpace
Thanks for letting me know!  Glad to hear I'm not the only one.  I spent a lot of time chasing a potential reverse proxy issue that wasn't there.  

I think I made some progress towards a potential fix.  
Not sure if this would be an official one, but I was able to get Uppy to work with $tempdir on 9.8 and 10 installs by making a small edit to /include/image_processing.php  -  See attached screenshot for exact locations

Version 10:
I manually added the $tempdir variable to global in line 36:
global $storagedir, $tempdir, $syncdir, $batch_replace_local_folder; 

Then $tempdir variable was added to valid_upload_paths around line 62:
under the $storagedir upload path:
$valid_upload_paths[] = $storagedir;
$valid_upload_paths[] = $tempdir;

I'm still testing this fix but so far uploads with Uppy and $tempdir are working and no other errors persist. 

I'll keep you posted and report back after some more testing!

Best Regards,

Brian
tempdir-uppy-98-10-imageprocessing.jpg

Brian Irwin

unread,
Sep 19, 2022, 1:29:34 PM9/19/22
to ResourceSpace
Hello!

This quick fix to image_processing.php (as outlined in my previous message) seems to be working for me after several days of testing uploads on 9.8 and 10, with and without reverse proxy.
No more crashes with $tempdir and Uppy uploader.
I'm going to roll with it for now until the RS dev team releases an official fix. 

Best Regards,

Brian


Reply all
Reply to author
Forward
0 new messages