Forum Discussion

M_A_Weiss's avatar
M_A_Weiss
Copper Contributor
Oct 28, 2023

Prevent Caching of Specific Files in IIS 10--Help with Code in web.config

I'm running a streaming server now, using nginx to ingest from OBS studio and write an .m3u8 and .ts files to IIS server directory. I've added MIME type .m3u8 to get it to work.

Initially I found that browser caching was preventing the stream from playing anything but the same 8-second segment. I was able to disable all caching with line 6 below from sample file I found online. However, I'd prefer not to disable ALL caching if possible.

I tried adding in line 3, 4 and 5 and changed the .jpg to my stream1.m3u8 file that I want to not be cached, but I got a 500 server error when I did that.

1

<configuration>

 

2

  ...

 

3

  <location path="myimage.jpg">

 

4

    <system.webServer>

 

5

      <staticContent>

 

6

        <clientCache cacheControlMode="DisableCache" />

 

7

      </staticContent>

 

8

    </system.webServer>

 

9

  </location>

 

10

</configuration>

There is another way supposedly to do this within IIS using the Output Caching menu and adding a rule to not cache specific files, but this does not work. It serves the stale video again. The only method that works so far, is the web.config edit disabling ALL caching (omitting lines 3,4,5).

Have I implemented either of these incorrectly?

 

 

 

Is it possible to stop the caching of .m3u8 file and .ts files without disabling ALL caching?

  • jrfinkel's avatar
    jrfinkel
    Copper Contributor
    Did you ever find a solution to this? I have exactly the same problem. Thanks.

Resources