Determine when cache will timeout for particular URL - google-chrome

I would like to look at previously loaded resources in the Chrome or Firefox browsers and see when the browser will consider that resource expired such that it will reload it from the server.
I am interested in doing this for two reasons:
Debug problems with appcache.
Confirm that I have the server configured properly by looking at resources to see if its expiration time is as I expect.

Related

How do I disable Chrome's memory cache without devtools?

Is there a way to disable Chrome's in-memory cache without changing caching headers in responses?
I found a few answers about disabling cache, caching headers, CLI arguments (like --disk-cache-size=1 and a few others), none of them seem to be able to disable the memory cache. Using the --disk-cache-size=1 flag, I was able to disable disk cache, but I couldn't find a way to do the same thing for memory cache.
In my scenario, I run automated tests that load a page with a request that responds with a caching header. However, I want this resource to be loaded each time a test runs, even if the browser is not restarted (performance reasons), in order to properly simulate delayed page loads. I have no means to change the request or response in any way, so I have to change how the browser loads it.
For the first test run, this works fine thanks to --disk-cache-size=1, but subsequent runs don't work because Chrome loads the resource from memory.
Neither I can change the request, nor the response, so changing caching headers or appending something to the URL of the resource is not an option. I want to run those tests in an automated fashion, so disabling the cache in devtools also doesn't work. Thus browser extensions also aren't feasible.
Is there any other way to disable the in-memory cache in Chrome (or other chromium-based browsers)?

Loading resources via URL is slow in Chrome - ONLY via https, ONLY from one specific website

I have this 1 Mb file for testing purposes (though the issue applies to any file hosted at lptoronto.com): https://lptoronto.com/sandbox/test.png
It always loads instantly in Internet Explorer (both via http and https).
In Google Chrome (currently Version 63.0.3239.132 (Official Build) (64-bit) on Windows 10) the situation is as follows.
When fetched via http, this file loads instantly without an issue.
When fetched via https, the same file takes about 40 (!) seconds to load (with very rare and irregular exceptions, when it also loads fast via https on occasion).
Chrome network monitor shows that all that 40 seconds the image is being slowly but steadily downloaded at low speed, i.e. there is nothing like waiting for server response etc.
Here's the screencast showing IE and Chrome side-by-side loading the same image:
https://www.youtube.com/watch?v=M4cUuhG1YuM
From time to time the issue disappears for a few minutes or an hour, but then re-appears again, without me doing anything on my side.
Same behavior is observed on at least one other computer - the one of my colleague (different ISP, different location).
Needless to say that I'm testing in a clean environment - cache cleared, extensions, firewall, antivirus disabled, connection verified and measured etc.
No Chrome issue whatsoever with any other website, be it http or https.
Hosting provider is yet unable to troubleshoot on their end, but they're still trying to help (it takes some time). They tried disabling mod_deflate, re-installing SSL, disabling caching rules, but to no avail.
The same issue was once observed about 2 months ago. That time I asked the hosting provider to disable SSL completely just to be able to work on my website content. When they re-enabled SSL in less than a day, the issue has gone; but now it re-appeared again, and there is no clue as to what is going on.
The bottomline:
issue appears only in Chrome, only with certain site, only with https
changing only the browser solves the issue
changing only the protocol (https to http) solves the issue
I honestly tried to google out anything similar, but failed to.
I would appreciate if you try the link above in the incognito Chrome window and report the load/refresh time, and of course any ideas are more than welcome.

Toggle between Html5 appcache when server if offline and use server when its up

I am using HTML5 appcache in my webapplicaiton. Basic idea is to serve content from appcache when server is offline and as soon as server is up , application can take content from server.
Is there a way to detect if server if offline and toggle between appcache and server.
Not exactly. You have a couple of options:
So long as you update the cache manifest properly when there's a content change in your site, as users 'go online' this update will be detected and the application will cache the relevant content
If there are areas of your site that simply should not be cached ever, that's what the NETWORK section of the cache manifest is for.
Following on from #2, conceivably you could also then combine online-only elements of your site with cached content and serve different items depending on the online state.
(Note that when it comes to detecting whether a browser is off-line or not, opinions vary across the different browser vendors. It may be wise to use a library for this, e.g. offline.js).
Sadly, no. Per the appcache spec, applicationcache does not work if the server can't be contacted.
Otherwise, if fetching the manifest fails in some other way (e.g. the server returns another 4xx or 5xx response or equivalent, or there is a DNS error, or the connection times out, or the user cancels the download, or the parser for manifests fails when checking the magic signature), or if the server returned a redirect, or if the resource is labeled with a MIME type other than text/cache-manifest, then run the cache failure steps.
Source

Chrome - multiple requests

Whenever I send a GET-request to my webapp using chrome, according to my apache access log two identical requests (not always, but most of the times, I can't reproduce it - it's not for the favicon) get send to the sever, although only one is shown in the chrome dev tools. I deactivated all extensions and it's still happening.
Is this https://news.ycombinator.com/item?id=1872177 true and is it a chrome feature or should I dig deeper within my app to find the bug?
I think it's even worse than that. My experience here (developing with Google App Engine), is that Chrome is making all kinds of extra requests.
This is possibly due to the option that is in the Settings, checked by default:
Predict network actions to improve page load performance
Here is a really weird example: my website's page runs a notifications check every 15 seconds (done in javascript). Even after closing all tabs related to my website, I see requests coming from my IP, some random pages but also the notification check request. To me that means that Chrome has a page of my website running in the background and is even evaluating its javascript.
When I request a page, I pretty much always get another request for one of the links in that page. And it also requests resources of the extra pages (.css, .js, .png files). Lots of requests going on.
I have seen the same behavior with the development server that runs locally.
Happens also from another computer / network.
Doesn't happen with Firefox.
Also, see What to do with chrome sending extra requests?

Safari Chrome Randomly Timeout, Firefox Never

Thanks in Advanced,
Safari and Chrome are randomly timing out / freezing / hanging. This happens randomly on random pages. I can click refresh about 5 times and then the pages load quickly. If I let it try to download, the page get the server is not responding error. The pages always load very fast with Firefox. I typically see the problem after I am logged in the backend which involves sessions / cookies. Cookies are enabled on both browsers. IE also works but is slower than firefox. I am not sure what is wrong with the code that is causing the problem.
Safari 6.0/
Chrome 21.0
Firefox 15.0
on Mac 10.8.1
I have also had problems on windows xp with chrome. Very few times I had lost my session and had to relogin on IE 6.
Try adding an EXPIRES header:
Web pages are becoming increasingly complex with more scripts, style
sheets, images, and Flash on them. A first-time visit to a page may
require several HTTP requests to load all the components. By using
Expires headers these components become cacheable, which avoids
unnecessary HTTP requests on subsequent page views. Expires headers
are most often associated with images, but they can and should be used
on all page components including scripts, style sheets, and Flash.
and configuring Entity Tags:
Entity tags (ETags) are a mechanism web servers and the browser use to
determine whether a component in the browser's cache matches one on
the origin server. Since ETags are typically constructed using
attributes that make them unique to a specific server hosting a site,
the tags will not match when a browser gets the original component
from one server and later tries to validate that component on a
different server.
I got the information above using YSlow on Chrome.