0

I'm trying to set expires headers for our sites running on nginx, and have limited experience with nginx, but have followed a lot of examples and manage to get it to work successfully, with the only problem being it totally breaks css/js in admin sections of the CMS.

We're working with craftcms and statamic, and it's the same problem with both. We also host our servers with Forge if that makes any difference.

The code that's setting the expires is:

location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp3|mp4|ogg|ogv|webm|htc|webp)$ {
        etag off;
        expires 1M;
        access_log off;
        add_header Cache-Control "public";
    }

Is there any way I can get that to only affect the public facing side, and not things within the /cp or /admin sections of the site?

None of the examples I've seen even mention this being a problem, so I'm not sure where I'm going wrong.

evu
  • 1,031
  • 2
  • 10
  • 29

0 Answers0