Nginix server config

Hi,

When I setup cache in nginix config like this:

location ~* \.(jpg|jpeg|png|gif|woff|woff2|ico)$ {
       expires 30d;
    }
    location ~* \.(css|js)$ {
       expires 7d;
    }

I can’t delete or change image in articles, it gives me error JSON API response error and I can’t access image also. Do anyone have ideas what can cause this issue?

My article.yml:

title: Article
num: date
icon: 📖

status:
  draft:
    label: Draft
    text: The note is still in draft mode. It can only be seen by editors with panel access.
  unlisted:
    label: In Review
    text: The note is online and can be visited with the direct URL. The team must still give the final go to publish it.
  listed:
    label: Published
    text: The note is online and listed in the blog

columns:
  - width: 2/3
    fields:
      text:
        type: textarea
        size: large

  - width: 1/3
    sections:
      image:
        label: Cover
        type: files
        template: image
        image:
          cover: true
        info: "{{ file.dimensions }}"
        multiple: false

Br, Ron

Don’t know a huge amount about Nginx configs, but I’m using an equivalent rule on Apache without any ill effects. What happens if you get more specific and just cache stuff under the assets folder and media folder?

If I don’t cache image files everything is ok an I can view or delete image.

Currently facing the same issue :thinking:
No idea why this happens with only images.

maybe this can help

location ~ /media/ {
	try_files $uri $uri/ /index.php?$uri&$args;
}

location ~ /api/ {
	try_files $uri $uri/ /index.php?$uri&$args;
}

location ~* \.(?:js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
	expires max;
	add_header Pragma public;
	add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
1 Like