pckg_expires_static
The `pckg_expires_static` directive sets expiration times for static files served by the Kaltura Media Framework.
Description
The pckg_expires_static directive is employed within the Kaltura Media Framework NGINX module to define and control the expiration times for static media files. By specifying a duration, administrators can control how long these assets are cached by browsers or intermediary proxies, which can significantly improve the performance of media playback by reducing load times and network traffic. This directive allows for a flexible caching strategy, enabling developers to manage how static content like videos, images, and other media files are delivered over the web.
When using the pckg_expires_static directive, you can set the expiration time using a specific time format (like '1h' for one hour or '2d' for two days). This time parameter signifies to the client how long they can cache the content before needing to request a fresh version from the server. Properly configuring cache expiration helps maintain an optimal balance between resource usage and ensuring users receive the most up-to-date content. However, improper or overly long expiration times can lead to users viewing stale content, so careful consideration must be taken when setting these values.
Config Example
http {
server {
location /static/ {
pckg_expires_static 1d;
}
}
}Setting an expiration time that is too long can result in serving stale content to users.
Make sure to test your expiration settings, particularly after updates, to ensure users receive the latest media files.