service workers and cache on WiseJ

0
0

Would it be possible to get a how-to/best practices guide for setting up service workers and server-cache settings to maximize page load times? esp for 3G/4g. or some  service worker sample code that works out-of-box for WiseJ.

I’ve tried wrapping my head around it many times, broken my WiseJ app several times, and I’m wondering if there are best practices to follow.

thanks

Andrew

  • You must to post comments
0
0

Right, I am wondering about the best practices to configure cache on an IIS web server to work with WiseJ.

For example, I had configured “HTTP Output caching” under IIS Manager by setting file types *.css *.js, etc, but I still had static assets (domain.io/Resources/Javascript/*.js etc) that were not being cached, but I fixed that by adding

<staticContent>
<clientCache cacheControlMode=”UseMaxAge” cacheControlMaxAge=”30.00:00:00″ />
</staticContent>

to my web.config file. But it seems this is not right use of etag?

 

I still now have these WiseJ managed resources that seem to never be cached no matter what — based on your explanation I am guessing this is not the expected behavior  (via https://www.giftofspeed.com)

https://domain.io/wisej.wx
https://domain.io/resource.wx/init?_sc=1537809853726
https://domain.io/resource.wx/wisej.min.css?v=1.5.19.0
https://domain.io/resource.wx/Wisej.Web/qx.min.js?v=1.5.19.0
https://domain.io/resource.wx/wisej.min.js?v=1.5.19.0

So it seems the browser will be forced to fetch the bootstrapper everytime (confirmed in network tab and Lighthouse). Per an earlier email you told me to exclude the .wx extension from “HTTP Output Caching”. In an earlier thread (https://wisej.com/support/question/static-content-can-be-cached) you said these files were cached but I can’t get it to work.

 

About Service Workers — -I know WiseJ doesn’t use Service Workers… the WebWorker example is not a service worker in the same sense as a PWA service worker as indicated by the guide. I’ve read the guide but had trouble implementing it.  The issues are complicated by server cache.

 

 

  • Luca (ITG)
    When the ETag matches the file is not downloaded again and it’s read from the local cache. You cannot alter the cache for .wx files or it will break the application. The tools that check the cache don’t know about Etag.
  • You must to post comments
0
0

Wisej doesn’t handle the browser cache. I don’t think there is a way to affect the browser cache in javascript. For the server side and only for Wisej managed resources we generetae ETags. There is nothing you need to do to manage that.

For all resources not managed by Wisej, which is every URL not ending with .wx, the caching method is managed by the web server.

Wisej doesn’t use service workers. There is a downloadable service worker extension and example in github. For a detailed service worker guide I found this: https://developers.google.com/web/fundamentals/primers/service-workers/ but it’s entirely out of the wisej scope.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.