Oops

Well this is going to be a short one. I’m happy to have taken care of this, it was one of my most wanted apps to have set up!

I’ve been struggling to get this up and running properly for months, trying off and on. I couldn’t find an official bug report or issue that seemed to line up with what I was experiencing, so I figured in the back of my mind that it was a user error. Everything seemed to be working correctly, except I would have about half of my library fail to upload from my mobile device for no discernible reason.

Shortly after the Immich team announced that it was going stable, I figured they must have fixed this issue I was having - or I could at least confirm that it was an issue on my end and not a known issue with the app. So I spun everything back up, and ran into the same issue. The mobile app had been updated to give more details about error messages though, and I was able to see much more details regarding the specific HTTP error - 413, request too large. Duh!

I don’t know how I missed this beforehand, because with some cursory research I found an official Nginx reverse proxy example with the following magical line:

# allow large file uploads
client_max_body_size 50000M;

I learned that Nginx has a default client_max_body_size of 1MiB, and thus the same images - any over 1MiB - wouldn’t upload. The ones that were below that size worked fine. I’m sure I could have done some better detective work to figure this out, and I’m not sure why I didn’t figure it out before this point, but it’s working now. Lesson learned for the future!

Config

Probably need to review this, as there are some things in the official example that I don’t have implemented - but I have yet to run into issues.

# /etc/nginx/sites-available/domain.com
 
server {
  listen 80;
  listen [::]:80;
 
  server_name *.domain.com;
 
  return 301 https://$host$request_uri;
}
 
# ...
# other subdomains
# ...
 
server {
  server_name img.domain.com;
  location / {
    proxy_pass http://127.0.0.1:2283;
  }
 
  listen 443 ssl;
  include snippets/domain-com.conf;
  include snippets/ssl-params.conf;
 
  client_max_body_size 50000m;
 
}
# /etc/nginx/snippets/domain-com.conf
 
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
# /etc/nginx/snippets/ssl-params.conf
 
ssl_protocols TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
ssl_ecdh_curve secp384r1;
ssl_session_timeout  10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";

EOF