I
Immich2mo ago
veil

(Solved) Immich behind reverse proxy very slow initial load in browser or app

Hi all. I’ve been using Immich for a long time, actually using it via Portainer. It works fine, but every day when I open Immich in a browser, the first 1–2 attempts just “loadaing” and then throw a 500 Internal Error. But for the ~ 3-4. attempt it loads fine and works smoothly… until the next day, when slowness starts again. Tested with multiple devices and with different ISPs in different cities. I’ve tried using Immich with Nginx, NPM, NPM Plus and now Caddy, but all of them had some speed issues. Other containers running through Caddy work fast. I assume the problem is something like Immich frontend is loading slowly, or some caching problems, IDK. I checked all 4 container logs (debug mode), but no errors. So my question is: What could cause Immich to be so slow when accessed via internet (reverse proxy) for the first time on a day? Now it works fine and flawlessly for me, but if I open it from another device or in incognito/private mode, the loading speed is slow again. Once it is loaded, then it's fast, thumnails are there, etc. I use it behind Cloudflare, but even with Proxied or DNS Only mode, the issue remains. I have no idea.
Solution:
Ok, problem solved. Below you can see my summary: Immich was extremely slow or failed to load initially in any web browsers, both in normal and in incognito mode. Many static asset requests (/_app/immutable/...) failed with 522 errors or returned the wrong Content-Type (text/html instead of text/javascript), breaking the frontend. Root Causes Identified & Fixed:...
Jump to solution
8 Replies
Immich
Immich2mo ago
:wave: Hey @veil, Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:. References - Container Logs: docker compose logs docs - Container Status: docker ps -a docs - Reverse Proxy: https://immich.app/docs/administration/reverse-proxy - Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA Checklist I have... 1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time). 2. :blue_square: read applicable release notes. 3. :blue_square: reviewed the FAQs for known issues. 4. :blue_square: reviewed Github for known issues. 5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy). 6. :blue_square: uploaded the relevant information (see below). 7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable (an item can be marked as "complete" by reacting with the appropriate number) Information In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider: - Your docker-compose.yml and .env files. - Logs from all the containers and their status (see above). - All the troubleshooting steps you've tried so far. - Any recent changes you've made to Immich or your system. - Details about your system (both software/OS and hardware). - Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h). - The version of the Immich server, mobile app, and other relevant pieces. - Any other information that you think might be relevant. Please paste files and logs with proper code formatting, and especially avoid blurry screenshots. Without the right information we can't work out what the problem is. Help us help you ;) If this ticket can be closed you can use the /close command, and re-open it later if needed.
Alex Tran
Alex Tran2mo ago
Hello, if it is accessible fine on the local IP. The issue will be in your networking setup
veil
veilOP2mo ago
Hi! Yes, you're right, I just want to hear some hints. Internet speed is 500/300 Mbit/s so this is clearly not an issue. Long time ago when Nginx was installed on my host PC everyrhing worked fine. Since the reverse proxy is in a container, I experience speed issues. I know It's not Immich issue but maybe Immich has some special needs if It's exposed to the internet via reverse proxy.
Zeus
Zeus2mo ago
No special immich Needs, no
Alex Tran
Alex Tran2mo ago
you can try a different reverse proxy like Caddy or something
Dikkiedick
Dikkiedick2mo ago
Just check my thread please, if not the case please discard https://discord.com/channels/979116623879368755/1366504693488156723 Also check developer tools in browser trying to identify issues
veil
veilOP4w ago
Thanks for the hint! My problem is different. For me the timeline is ok. Once the initial load has finished, everything is smooth. I'll try to move my Caddy from container to the host PC.
Solution
veil
veil4w ago
Ok, problem solved. Below you can see my summary: Immich was extremely slow or failed to load initially in any web browsers, both in normal and in incognito mode. Many static asset requests (/_app/immutable/...) failed with 522 errors or returned the wrong Content-Type (text/html instead of text/javascript), breaking the frontend. Root Causes Identified & Fixed: - Cloudflare proxy (orange cloud) was enabled, which interfered with streaming JS modules and chunked asset delivery. This caused intermittent 522 and CORS-related failures. - Stale in-memory browser cache in private sessions preserved bad HTML responses as JS, compounding errors. Solutions Applied: - Switched Cloudflare DNS to DNS-only (grey cloud) — resolved all CDN-induced issues. - Increased Caddy proxy timeouts to ensure larger responses weren't prematurely cut off (maybe it is not necessary at all)

Did you find this page helpful?