Changes to a file require two page refreshes - iis

After updating a file, when running on my dev machine, I need to refresh my browser twice in order to see the changes.
How do I see the changes upon the first refresh?
Its not the browser's cache. It doesn't happen with the same browser on the live site. Server is IIS Express.

You can force your browser to empty its cache by using ctrl+f5

Related

How to stop index.html being cached by Azure CDN

I am using Azure CDN to host a static website I am building.
It's great, other than the fact that when I update my web app the old page is cached and so still shown.
I have added the following Cache rule in the rules engine to put it to refresh every 60 seconds, however this does nothing and I still get the old content, the only way to get the new content is to go to an incognito browser.
Anyone have any ideas it's driving me crazy!
Here is a screenshot of the browser dev window when I hit the index.html page, I can't see any cache control headers here, I would think that the Azure CDN would/should be putting these on, is that incorrect?
The rule you are modifying controls the "internal max age". If a file shows up correctly in icognito mode, this rule is working fine. You have to set "external max age" to control the Cache-Control header.
https://learn.microsoft.com/en-us/azure/cdn/cdn-verizon-premium-rules-engine-reference-features
Looks like it is not Azure CDN which is caching index.html, it is your browser. Ensure that the Cache-Control header is returned correctly by using the developer tools.
https://learn.microsoft.com/en-us/azure/cdn/cdn-manage-expiration-of-cloud-service-content
https://learn.microsoft.com/en-us/azure/cdn/cdn-manage-expiration-of-blob-content

Cache control header not working

I have set Cache control in my response header as Cache-Control:public, max-age=86400. But when I try to refresh page or open a new tab, it always hits my server. The response status I got is 200, server log is appeared for this request also I checked chrome://cache/ this request is not in the list. I already looked some similar SO questions cache-control not working without etag and why cache-control:max-age don't work?. But still with no luck. Tested on chrome 56.
Chrome disables cache when DevTools is open, or at least it does Chrome 59. Open DevTools, go to Network, uncheck "Disable cache" at the top. Now you should be able to refresh the page and see it in chrome://cache.
Cache control tells your browser (and proxy servers like Squid) what resources it cannot cache. But it does not force your browser to cache a resource.
I recommend to check the error_logs to see if you really go to the backend, or stay in the browser.
In my case, browser gives me 200OK in the console logs but I don't reach the back end according to the error_log ...
Cache-Control response header will not work for page refresh. Try making that request twice without refreshing the page, then you will see it being cached (the request won't reach your server internally).
To achieve what you want you might have to cache your request by accessing localStorage, or just cache it through a back-end caching library.

Strage DNS behavior in Chrome vs Firefox

When I try to visit http://www.taobao.com/ in Chrome I get taken to an ISP error page (http://hndnserror4.wo.com.cn:8080/issueunziped/hn20150626/index.htm?sf=&UserUrl=www.taobao.com). This doesn't happen in Firefox. I've trying clearing the DNS cache both system-wide and in Chrome.
How I can diagnose the issue?
Edit: I've simplified the question for the bounty. This problem happens on Arch Linux. I've tried using DNSCrypt. I've changed /etc/resolv.conf to use various DNS servers such as Google's. I've tried clearing the host cache from chrome://net-internals/#dns. I've disabled using a web service to help resolve navigation errors in Chrome's settings. Nothing works and every time I try to open taobao.com in Chrome I get the ISP error page. It opens the error page instantly without a redirect or waiting for the hostname to resolve. When I enter "taobao.com" into the address bar and hit enter with the Network tab open I see the first request is recorded as having a request URL of http://hndnserror4.wo.com.cn:8080/issueunziped/hn20150626/index.htm?sf=&UserUrl=www.taobao.com. How is "taobao.com" getting transformed into that between hitting enter and the page loading?
I've submitted a bug: https://code.google.com/p/chromium/issues/detail?id=510680&thanks=510680&ts=1437020912
I resolved the issue by clearing the browser data. Strange, but it worked. I went to Settings -> History -> Clear browsing data. With the defaults checked (clear following items from the past hour) it allowed me to visit http://taobao.com again. Creating a new profile didn't help. Nor did clearing the DNS cache from chrome://net-internals. I don't know if it's a bug in Chromium but I'm content to have resolved the issue.

After renaming xhtml pages, old file getting loaded in jsf

I am having some kind of strange problem which i am not able to debug.
Our application servers needs the downtime and hence we have built the temporary xhtml page for our website which will give the message that temporary servers down. Our plan is that during downtime we will rename our original index.xhtml page to something like index-original.xhtml and downtime.xhtml to index.xhtml. So during downtime we can show the website temporary unavailable page. And we will revert these changes when downtime is over
Now when we were testing this renaming thing, we found out that even after renaming the downtime page to index.xhtml and preserving the original index page, browser was still loading the original index page. We have disabled the caching by using following code in login filter.
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
res.setHeader("Pragma", "no-cache"); // HTTP 1.0.
res.setDateHeader("Expires", 0); // Proxies.
res.setHeader("Access-Control-Allow-Origin", "*");
What I found from the server logs is that, the request is hitting the server, but somehow browser is still showing the old page. When i checked in the browser's developer tools, i found that page is not getting loaded from cache and it is coming from server. But somehow server returning the old page after renaming
After one server restart, the renamed downtime page gets dispalyed.
The same server restart required when we want our original home page page back after the downtime is over.
My concern is, why server restart is required for this renaming to work? Shouldn't it load the renamed file directly as the request is hitting the server.
I get the following messages ocassionally in chrome developer tool is
Document was loaded from Application Cache with manifest https://www.google.co.in/_/chrome/newtab/manifest?espv=2&ie=UTF-8
Application Cache Checking event
Application Cache NoUpdate event
But in the network section of developer tool, it is not showing that page is loaded from cache.
I am thoroughly confused here as i am a junior developer.
Most likely you have facelet caching turned on. See this stackoverflow answer JSF and automatic reload of xhtml files

Fiddler2 doesn't show captured traffic IF session was deleted previously

Let's say I capture the traffic between my PC and stackoverflow. If I delete this session in Fiddler, it won't be shown again if I try to capture the traffic.
What to do ?
Typically, this means that your browser cached the traffic, so that it doesn't hit the network to reload the page later. Either hit refresh in your browser (e.g. CTRL+F5 for IE) or clear your browser's cache before attempting to reload the page.

Resources