Cache Busting not working in CefSharp

I am using cefsharp (chromium embedded framework for .NET) to host a web application that uses require js to load in most of my javascript modules.

To speed up my application I have enabled cacheing via response headers "Cache-Control: public,max-age=864000" for all my static content.

When I deploy a new version of my web application i am appending a version number that gets incremented with every deployment in the urlArgs param of require.config() to perform a "cache bust" when my content changes as require JS does not send the "If-Modified-Since" or "If-None-Match" request headers so the browser is not automatically detecting my changes based on e-tag or last modified date.

This "cache busting" solution works perfectly in IE9, IE10, and Standalone chrome (version 35 currently). My problem is that cefsharp seems to completely ignore my cache bust query string and will still go to the cache when i change the query string. Even if i append a completely different query string such as a timestamp (see snippet below for example) it does not pull down a new version.

From what i can tell this seems to be a bug or possibly a configuration setting that i am unable to find in either CEF or cefsharp but i cannot find any information around why cef/cefsharp would be ignoring my query strings and going directly to cache.

I have run fiddler and can see that it cefsharp does not make a request when i change the query string. I also do see the query string is present on the initial load (when i manually delete the cache folder and reload).

Does anyone have any clues as to why cefsharp would be behaving like this? I have tried both the stable build (which uses chromium 25.x) as well as the Pre-release build. Both behave the same.

CefSharp releases: https://github.com/cefsharp/CefSharp

Require JS url args code snippet:

(function () {
    "use strict";
    require.config({
        waitSeconds: 200,
        paths: {
            //Removed for brevity
        },
        shim: {
            //Removed for brevity
        },
        urlArgs: 'v=8.4.1.7',
        //urlArgs: "bust=" + (new Date()).getTime() //(also tried this as a test, no luck)
   });
})();

Cache settings that i have configured in CefSharp (included only the relevant pieces):

Private WithEvents _webView As CefSharp.WinForms.WebView
Private WithEvents _rq As Object

Private Sub Initialize()
    'Enable both applicaton and page cache settings (i have tried disableing application cache, did not help)

    Dim settings = New BrowserSettings()
    settings.ApplicationCacheDisabled = False
    settings.PageCacheDisabled = False
    settings.LocalStorageDisabled = False

    Dim s = New CefSharp.Settings()
    s.PackLoadingDisabled = True            
    s.CachePath = "SOME_USER_SPECIFIC_PATH" 'Removed the actual path building code

    If CEF.IsInitialized = False Then
        CEF.Initialize(s)
    End If

    _webView = New CefSharp.WinForms.WebView(_url, settings)
    _rq = New RequestHandler
    _webView.RequestHandler = _rq
    _webView.Dock = DockStyle.Fill

    _webView.Refresh()
    _webView.Load(_url)
End Sub

Can anyone offer any suggestions, settings i should try, workarounds etc? The one thing that is not really an option for me is to manually delete the cache folder on every deploy due to reasons that i will not get into.

Any help is much appreciated.

Thanks

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.