0

Server is Windows Server 2016

I need to serve a single static file with a different header than all the other files (Cache-Control: max-age=15)

A different answer gives the leaf XML node as: <clientCache cacheControlCustom="private" cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:15" /> but only how to apply it to every file.

File needs to be posted to our public web server quickly and updated quickly for debugging. Final application will not be using a static file.

2
  • IIS settings can be configured at file level via <location> tags. That's something you might explore and should fulfill your needs. Commented Feb 12, 2024 at 22:39
  • @LexLi: I ended up creating a new virtual directory in IIS to get the test URL up and running; however from a blog post that looks like a reasonable answer. Commented Feb 13, 2024 at 1:11

1 Answer 1

0

Stopgap answer:

Create a new virtual directory and put the file in it and set the header in <customHeaders> tag:

 <customHeaders> <add name="CacheControl" value="max-age=15" /> </customHeaders> 

There ought to be a better answer but this got me up and running.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.