YunoHost-Apps / my_webapp_ynh

Custom Web app with SFTP access
GNU General Public License v3.0
47 stars 39 forks source link

Configure caching settings from admin panel #108

Open xplosionmind opened 1 year ago

xplosionmind commented 1 year ago

I am getting crazy trying to manually configure Nginx to cache static resources…

It would be great if such configuration could be performed right within YunoHost, without needing to meddle with the Nginx file.

xplosionmind commented 8 months ago

To provide more context, here is what I added to my Nginx config, in /etc/nginx/conf.d/tommi.space.d/my_webapp.conf:

        # Cache-Control headers for static assets
        location ~* .(?:webp|jpg|png|svg|aiff|jxl|woff|woff2|wav|mp3|m4a|mov|aac)$ {
                expires 1y;
                add_header Cache-Control "public";
        }
        location ~* .(?:js|json)$ {
                expires 4w;
                add_header Cache-Control "public";
        }
        location ~* .(?:css)$ {
                expires 1w;
                add_header Cache-Control "public";
        }