Try_files and expires

Hi,

I have a case with a CMS (pimcore) and setting the expires directive.

 location / {
     # First attempt to serve request as file, then as directory,

then fall back to index.php
try_files $uri $uri/ /website/var/assets/$uri /index.php?$args;
index index.php;
}

So, there are “assets” (pdfs, mostly but also some images) in a
subdirectory.

This works, but this directive:

 location ~*

.(jpe?g|gif|png|bmp|ico|css|js|pdf|zip|htm|html|docx?|xlsx?|pptx?|txt|wav|swf|avi|mp\d)$
{
access_log off;
log_not_found off;

     expires 1w;
 }

breaks the first directive.

Is there a way to have both?

Rainer

On Tue, Dec 08, 2015 at 03:34:28PM +0100, [email protected] wrote:

Hi there,

This works, but this directive:

Is there a way to have both?

One request is handled in one location. Put the configuration that you
want, in the location that is matched.

It is not immediately clear to me what response you want for a request
for /one.pdf.

Perhaps add the try_files to the regex location?

f

Francis D. [email protected]