From 1cd7d01b4e55a583c6d49289ea68579461cb79ed Mon Sep 17 00:00:00 2001 From: johnny2211 Date: Sun, 18 Jan 2026 19:09:37 +0100 Subject: [PATCH] Update GIF guide with nginx troubleshooting section Added detailed troubleshooting section for the nginx configuration issue that caused 404 errors for GIF files. Changes: - Added new troubleshooting subsection: 'GIFs return 404 but files exist' - Documented the nginx regex problem and solution - Included before/after nginx configuration examples - Explained negative lookahead regex pattern - Updated Docker image digest to latest version - Added latest commit reference (bc688e5) This helps future admins understand and debug similar nginx routing issues where static asset caching interferes with backend proxying. Co-Authored-By: Auggie --- GIF_REGENERATION_GUIDE.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/GIF_REGENERATION_GUIDE.md b/GIF_REGENERATION_GUIDE.md index 9009332..362bfb3 100644 --- a/GIF_REGENERATION_GUIDE.md +++ b/GIF_REGENERATION_GUIDE.md @@ -143,6 +143,29 @@ For each video in the database, the system will: - Ensure `/uploads/gifs/` directory is writable - Check file ownership and permissions +### GIFs return 404 but files exist on server + +This was a nginx configuration issue (fixed in commit bc688e5): + +**Problem:** nginx regex for static assets was catching ALL `.gif` files, including those in `/uploads/gifs/`, and trying to serve them from frontend `dist/` directory instead of proxying to backend. + +**Solution:** Updated nginx.conf to exclude `/uploads/` path from static asset caching: +```nginx +# Before (broken): +location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; +} + +# After (fixed): +location ~* ^/(?!uploads/).*\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; +} +``` + +The negative lookahead `(?!uploads/)` ensures files under `/uploads/` are proxied to backend, not served as static assets. + ## Technical Details - **GIF Generator:** Uses ffmpeg with two-pass palette optimization @@ -167,5 +190,6 @@ Use Option 1 (Web UI) or Option 2 (Docker env var) from above. **Last updated:** 2026-01-18 **Docker image:** `git.matijaturk.from.hr/johnny2211/znakovni.hr:latest` -**Digest:** `sha256:5deeaa941152012c5c49823de607b365656ca21cdccb2d914a66e00497d45c9f` +**Digest:** `sha256:9d17eac2038678e8b65d54eb8a5f1b99974810f829ff414288deb849876db620` +**Latest commit:** `bc688e5` - Fix nginx configuration for GIF serving