« Previous Next »

Thread: Configured for client caching but Expires header not showing in Response Headers

Last post 10-14-2009 8:59 AM by 360airwalk. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 05-11-2009, 8:28 PM

    • ronpeled7
    • Not Ranked
    • Joined on 05-12-2009, 12:24 AM
    • Posts 3

    Configured for client caching but Expires header not showing in Response Headers

     I am trying to configure a server to use client caching, ie - show 'Expires' header for certain file types. For now I would like to start with the style sheets (*.css) which are located under the /css folder. I have these lines in a web.config inside the css folder:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="01:00:00" />
            </staticContent>
        </system.webServer>
    </configuration>

    but without success. I also followed many other tutorials and guides but nothing worked, please assist!

    The server is Windows Server 2008 with IIS7. Please let me know,

  • 05-13-2009, 4:19 AM In reply to

    • WWWWeb
    • Top 100 Contributor
    • Joined on 04-30-2009, 9:42 AM
    • Posts 52

    Re: Configured for client caching but Expires header not showing in Response Headers

    I was able to see follow header in the response with your web.config.

    Cache-Control: max-age=3600\r\n

    Are you able to see these setings via "http response headers", "set common headers" in UI?

  • 05-13-2009, 1:10 PM In reply to

    • ronpeled7
    • Not Ranked
    • Joined on 05-12-2009, 12:24 AM
    • Posts 3

    Re: Configured for client caching but Expires header not showing in Response Headers

     The problem that I encounter is that in addition to the Cache-Control: max-age=3600 I also get another Cache-Control: max-age=0 in the Request Headers. But I would much rather see an Expires header.

     

    any idea?

  • 05-14-2009, 2:18 AM In reply to

    • WWWWeb
    • Top 100 Contributor
    • Joined on 04-30-2009, 9:42 AM
    • Posts 52

    Re: Configured for client caching but Expires header not showing in Response Headers

    what's your config of <staticContent> in application.config or root web.config?

  • 05-14-2009, 7:36 PM In reply to

    • ronpeled7
    • Not Ranked
    • Joined on 05-12-2009, 12:24 AM
    • Posts 3

    Re: Configured for client caching but Expires header not showing in Response Headers

     <staticContent> directive lives inside my web.config, here it is:


            <staticContent>
                <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
            </staticContent>

  • 10-14-2009, 8:59 AM In reply to

    Re: Configured for client caching but Expires header not showing in Response Headers

    I, for example, use this setting in the exact same environment. it works fine. i put this into the application's web.config file.

    <staticContent>
        <clientCache cacheControlCustom="public;max-age" cacheControlMode="UseMaxAge"     cacheControlMaxAge="180.00:00:00" />
    </staticContent>

     which enabled clients to cache static content (e.g. css files) for half a year. so you might have to add the cacheControlCustom attribute.

    you can also apply http caching headers via the IIS 7 manager. just select the css directory in the left pane, click "HTTP Response Header", then click "Set Common Header..." on the right side. In the popup window choose "Expire Web content:" and select either "After:" or "On" and enter the desired expiration.

     One approach would be to check all directory from your web application's root to your css directory for web.config entries regarding clientCache and see if you overwrite certain attributes.


Page 1 of 1 (6 items)
Microsoft Communities