# Include this fragment in the server block that serves immutable plugin releases.
root <ONLYOFFICE_RELEASE_ROOT>;

# Keep cached editor configs on the previous plugin URL working during the rename window.
location ~ ^/onlyoffice-plugins/([^/]+)/eln-template-filler/(.*)$ {
  add_header Cache-Control "no-cache" always;
  add_header X-Content-Type-Options "nosniff" always;
  return 307 /onlyoffice-plugins/$1/eln-record-filler/$2;
}

location ~ ^/onlyoffice-plugins/[^/]+/eln-record-filler/(?:config\.json|index\.html)$ {
  add_header Cache-Control "no-cache, must-revalidate" always;
  add_header X-Content-Type-Options "nosniff" always;
  try_files $uri =404;
}

location ~ ^/onlyoffice-plugins/[^/]+/eln-record-filler/assets/.+-[A-Za-z0-9_-]+\.(?:js|css)$ {
  add_header Cache-Control "public, max-age=31536000, immutable" always;
  add_header X-Content-Type-Options "nosniff" always;
  try_files $uri =404;
}

location ~ ^/onlyoffice-plugins/[^/]+/eln-record-filler/resources/icon(?:@2x)?\.png$ {
  add_header Cache-Control "public, max-age=604800" always;
  add_header X-Content-Type-Options "nosniff" always;
  try_files $uri =404;
}
