2023-10-23, 10:44 PM
I'm not sure what cookies have to do with this tbh, my understanding is that they're mainly used to store things like user sessions and preferences.
I asked ChatGPT to explain the difference between cookies and cache in laymans terms because I was a bit unsure myself, and it provided the following analogy:
I verified this information by checking the MDN web docs for caching and cookies.
I am having the same issues as you, OP, and so I wanted to try creating a cache rule for my Nginx reverse proxy virtualhost for Jellyfin. You didn't mention if you're using a reverse proxy at all, but I'll assume you are since you mentioned serving multiple users in your post.
I found this documentation entry for Nginx helpful. It outlines how to define cache headers for your host. Using that information I haphazardly placed the following in the server block for my virtualhost:
After clearing the site data for my Jellyfin instance I was able to verify that the new caching headers did appear. The code above basically tells the visitors browser to cache responses for up to 12 hours, and then check if something has changed after that.
I'm hoping this will solve the issue, but I won't know until I've had some of my users verify it, which will take time. I just also want to add the disclaimer that I'm just a beginner at this stuff and I wouldn't recommend people just throw this into their configs without knowing what it does.
I'm also not sure if this happens because Jellyfin caches responses itself. If that's the case it doesn't really matter what I do with Nginx as the root cause of the problem would be with Jellyfin itself. Hopefully this helps though.
I asked ChatGPT to explain the difference between cookies and cache in laymans terms because I was a bit unsure myself, and it provided the following analogy:
Quote:Imagine you're at a café (which represents a website) and you order a coffee (which is a web page). Now, here's how the concepts of HTTP cookies and cache work in this context:
HTTP cookies are like the café staff noting down your preferences. Let's say you ordered your coffee with a bit of sugar. The staff remembers this and prepares your coffee with sugar each time you visit. Similarly, when you visit a website, it might give your web browser a cookie, a small piece of data that remembers things like your username, preferences, or items you put in a shopping cart. This helps the website recognize you and provide a personalized experience, like remembering your login details or keeping items in your cart even if you leave the site.
On the other hand, the cache is like a barista keeping a copy of the coffee menu handy. When a lot of people order the same coffee, the barista doesn't have to look at the recipe book every time. They just refer to the handy copy and make the coffee quickly. Similarly, when you visit a website, your browser stores certain parts of the website, like images or files, in its cache. So, if you visit the same website again, your browser can quickly retrieve these stored parts instead of fetching them all over again, making the website load faster.
In short, HTTP cookies remember your preferences and help websites remember you, while cache stores parts of a website to make it load faster when you visit it again.
I verified this information by checking the MDN web docs for caching and cookies.
I am having the same issues as you, OP, and so I wanted to try creating a cache rule for my Nginx reverse proxy virtualhost for Jellyfin. You didn't mention if you're using a reverse proxy at all, but I'll assume you are since you mentioned serving multiple users in your post.
I found this documentation entry for Nginx helpful. It outlines how to define cache headers for your host. Using that information I haphazardly placed the following in the server block for my virtualhost:
Code:
# Set caching headers for the entire server block
add_header Cache-Control "public, max-age=43200";
set $expires_time 43200;
add_header Expires $expires_time;
After clearing the site data for my Jellyfin instance I was able to verify that the new caching headers did appear. The code above basically tells the visitors browser to cache responses for up to 12 hours, and then check if something has changed after that.
I'm hoping this will solve the issue, but I won't know until I've had some of my users verify it, which will take time. I just also want to add the disclaimer that I'm just a beginner at this stuff and I wouldn't recommend people just throw this into their configs without knowing what it does.
I'm also not sure if this happens because Jellyfin caches responses itself. If that's the case it doesn't really matter what I do with Nginx as the root cause of the problem would be with Jellyfin itself. Hopefully this helps though.
JF Server Specs:
- CPU: Intel Core i5-11400
- Motherboard: ASRock H510M-ITX/ac
- RAM: G.Skill 16GB (2x8GB) Value 2666MHz CL19 DDR4
- PSU: Silverstone SX300-B 80+ Bronze SFX
- OS: Debian 12
- JF: 10.10.1