These are chat archives for canjs/canjs

8th
Sep 2016
Sérgio Cunha
@sergiomcunha
Sep 08 2016 16:41
Hy
Have someone already implemented accessibility mechanisms with canjs?
Sunil George
@georgesunil81
Sep 08 2016 17:13
A quick question if somebody can help. I am facing a problem where my index.html is being cached in client's browsers due to which they are not seeing the latest CanJS changes. How can I prevent my index.html from being cached?
Justin Meyer
@justinbmeyer
Sep 08 2016 17:23
@georgesunil81 you'll need to set expires headers right on your server
Sunil George
@georgesunil81
Sep 08 2016 17:27
@justinbmeyer, I don't have access to my server, only access I have is to the index.html. I have set the following headers already but it does not work -
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">    
        <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Expires" content="0">
@justinbmeyer do you spot anything else that I should add to my index.html so that it is not cached in any browser!?
Please let me know once you get a chance.
Justin Meyer
@justinbmeyer
Sep 08 2016 17:31
@georgesunil81 this isn't the sorta thing I'm an expert at
so I really don't have any advice to offer here
other than keep searching google ...
this is sorta outside CanJS
Thomas Sieverding
@Bajix
Sep 08 2016 18:18
@georgesunil8 You basically need to do all headers via the server
Sunil George
@georgesunil81
Sep 08 2016 18:23
@Bajix, could you elaborate, here is my index.html in its entirety.
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Expires" content="0">

        <title>My Application</title>
        <link href="dist/css/main.css" rel="stylesheet" />
    </head>
    <body>
        <script src = "./dist/bundles/node_modules/steal/steal.production.js" main="main" cache-version=17></script>     
    </body>
</html>
As you can see, I am implementing the cache-version that busts the cache for .js files, but the problem is that my index.html gets cached!
My application does not have server side rendering. All of it is initiated by the index.html file provided above.
Thomas Sieverding
@Bajix
Sep 08 2016 18:25
@justinbmeyer It would be extremely useful to be able to swap out set logic and not have to do anything special with cache-requests. My use case here is to basically have the serialized state of my viewModel correlate w/ the set logic that filters my data set. This is then decorated w/ components that manipulate some state via bindings
Eben
@eben-roux
Sep 08 2016 18:26
@georgesunil81 what is hosting your index.html file?
Thomas Sieverding
@Bajix
Sep 08 2016 18:26
The approach I’ve been using in the interim leverages can-derive/list/to do a dFilter. This would be excellent functionality to have out of the box w/ can-connect
@georgesunil81 Even if you’re not using SSR, and are simply serving static files, you can still set headers on any request
I believe the default behavior of something like express.static uses ETAG’s anyway
So simply using that, and applying cache headers in later middleware will suffice
Sunil George
@georgesunil81
Sep 08 2016 18:43
@eben-roux @Bajix , my index.html is being hosted by IIS server. It simply serves it as a static file! Can anything be done in this situation?
Eben
@eben-roux
Sep 08 2016 18:45
mmm... is it shared hosting then that you cannot change anything? how about the web.config file?
Sunil George
@georgesunil81
Sep 08 2016 18:49
@eben-roux, it is a dedicated server. I do not have access to the server though. Can anything be done in the web.config file on the server so that my index.html is never cached?!
Eben
@eben-roux
Sep 08 2016 18:52
I usually have a module handle these things but if you can't create/add one... although... could you not add a module to your site and load it via the web.config?
Sunil George
@georgesunil81
Sep 08 2016 18:56
Thanks @eben-roux for the link. I will check it out. Will let know if I have any questions.
Sunil George
@georgesunil81
Sep 08 2016 20:15
That link is very useful @eben-roux . It explains what I could do in the webserver config file to disable caching for a set of files or for my specific index.html file. I will test it out soon and see if it works for me. Meanwhile, I have never come across a module to disable caching for a specific file. Could you send me a sample module that may help me?