# The app's own shell is never served from a cache.
#
# The API already says this for itself (App\Http\Middleware\NoStoreApiResponses):
# a LiteSpeed cache switched on for a whole cPanel account will happily keep a
# copy of an answer PHP marked private, and the owner met that once already as
# a product saved and then missing from the list.
#
# index.html is the same fault one floor up, and worse. It is the only file in
# the build whose name does not change: everything else Quasar emits carries a
# content hash, so a new build writes new filenames, but the page that NAMES
# those files keeps its own. A stored copy of it therefore goes on loading
# yesterday's bundle for as long as the cache holds it, however many times the
# shop uploads a new build — and yesterday's bundle has yesterday's sidebar and
# yesterday's routes. Every page added since then is missing from the menu and
# refused at its own address: seven working report rooms reported as "not
# working and not linked", with nothing in the app to say the browser was
# reading an old copy of it.
#
# So: the shell is re-read every visit, and the hashed files it names are kept
# for a year. The immutable rule is written FIRST on purpose — Apache lets a
# later Header set win, and config.js and sw.js match both patterns.
<IfModule mod_headers.c>
  <FilesMatch "\.(js|mjs|css|woff2?|ttf|otf|eot|svg|png|jpe?g|gif|webp|avif|ico)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>

  # The four files whose names never change, and so may never be kept.
  <FilesMatch "^(index\.html|config\.js|sw\.js|manifest\.json)$">
    Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
    Header set Pragma "no-cache"
    # LiteSpeed reads its own instruction before the standard one.
    Header set X-LiteSpeed-Cache-Control "no-cache"
    Header unset ETag
    Header unset Last-Modified
  </FilesMatch>
</IfModule>

# Same instruction again for hosts that run the LiteSpeed cache module rather
# than reading the header above.
<IfModule LiteSpeed>
  CacheDisable public /index.html
  CacheDisable public /config.js
</IfModule>

# Deep links are hash routes (#/), so there is no rewrite rule here and none is
# needed — the server only ever serves index.html itself.
