Chrome loading cached files on localhost - google-chrome

I'm having this problem across 2 different machines now.
Version 63.0.3239.84 (Official Build) (64-bit)
OSX 10.12.6
Chrome is persistently loading old cached files on http://localhost:3000. The only way I can stop it, is to use incognito. If I use cmd + shift + r it works for a single refresh, then goes back to the old files on reload.
I typically have the inspector up so I've tried ticked disable cache, that doesn't nothing. I've also tried deleting my cached files through chrome's settings, that does nothing.
Anything I'm missing here?

Finally realised what it was. A previous server I was running on that port had a manifest file and the appropriate service workers. It means that chrome was loading those cached files by default.
To fix it I went into developer tools > application > clear storage.
It now works as expected.

Are you sure is it a chrome cache? I mean, check if its really chrome cache getting the full of data in another way like curl, for example:
curl http://localhost:3000
If the content still not reloaded is not chrome problem but another think like your webserver.
If you are running Nginx don't worry it is Nginx configuration called sendfile and you can change it easily just doing this follow steps:
Step 1 - Open nginx configuration with your text editor(vim in my case)
vim /etc/nginx/nginx.conf
Step 2 - Search the line with this text:
sendfile on;
Step 3 - Change to off
sendfile off;
Step 4 - Restart your nginx:
/etc/init.d/nginx restart
Note: If you are using virtual environment like Vagrant reload it
vagrant reload

In my case, Chrome was generating local overrides, for some reason. Before discovering this, I switched ports several times to get past the issue. Chrome had created a local override for my index.html file for each port. After deleting the local overrides, the actual from the server started coming through just fine.

Related

Chrome is using a cached page when local-serving for web-development

I'm using a node.js local server to serve Chrome a three.js page, and Chrome instead of updating the page when I reload it after I've done some changes, it reloads a cached version instead, and will only update it after I clear all history, then close and re-open the dumb Chrome, which is extremely frustrating and inefficient. That doesn't happen with Firefox. Any ideas?
node.js server run on a .bat file inside the working folder:
http-server -p 8000
exit
on address bar:
http://localhost:8000/mypage.html

XAMPP is not updating .html/.js files on reload

I recently installed XAMPP on a windows machine(Windows 10) just to get a local server up and running so that I could make API calls and not run into any CORS issues and it was working fine.
Now what is happening is that whenever I make any changes in the .html or .js files it won't update the page, I have cleared all the browser history , temp files, restarted XAMPP, closed and reopened the browser (in the root folder there is only a single .html file so no clash there) but still it won't update.
Is it something related to XAMPP(v3.2.2) or any local settings that I have to configure.
Browser: Chrome 65, though it is the same issue with firefox and IE.
It can be due to serve caches. You need to clear those caches. Go to browsing history and clear there or you can just right click on the reload button on chrome and click hard reload and cache clear.
When this happens to me I usually do (if you're using Mac) SHIFT + Cmd + R and if that doesn't work i close the tab (Chrome) and open a new one.

Google Chrome Ignoring Hosts File

Google Chrome is ignoring the settings in C:/Windows/System32/drivers/etc/hosts file. Both IE11 and Firefox are installed on the same machine and work as expected.
I've tried all the solutions I could find online including:
Open chrome://net-internals/#dns and click the Clear Hosts Cache button.
Go in Settings, Show Advanced Settings and uncheck the following three options: (X) Use a web service to help resolve navigation errors (X) Use a prediction service to help complete searches and URLs typed in the address bar (X) Use a prediction service to load pages more quickly
Go in Settings, Show Advanced Settings, click the Clear Browsing Data button, selected Cached Images And Files from the beginning of time, and click Clear Browsing Data.
Restart Chrome.exe.
Restart the computer.
Make sure to add http:// to the front of the web address.
Make sure proxy settings are turned off
Run cmd.exe and run ipconfig /flushdns
Uninstall and reinstall Chrome
I'm at a loss... Is there anything I missed that I can try or check?
Seems that Chrome doesn't likes the following extensions for that kind of stuff:
.dev
.localhost
.test
.example
.app
Use .local and the problem seems to disappear.
If anyone stumbles on this problem in 2021, for me the fix was to disable Use secure DNS option from chrome settings. After disabling that, all the options in the hosts file started working.
The option is located under Privacy and Security > Use secure DNS
Link to get there faster:
chrome://settings/security
This has been identified as a "bug" in Chrome, but it appears to be absolutely intentional behavior. Google Chrome does not honor /etc/hosts when connected to the Internet. It always does a DNS lookup to determine IP addresses.
While my references below mostly relate to my expereinces with this on Linux, it is not confined to Linux.
https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/iKXqyc40tW0
https://superuser.com/a/887199/75128
https://bugs.chromium.org/p/chromium/issues/detail?id=117655
Okay I faced the same problem but then I found the solution.
Try this:
Go to history (Ctrl+H) -> In the left pane click on Clear browsing data
In the new window that opens go to Advanced tab
Set Time Range to All Time -> check Cached Images and Files -> click on Clear data
Restart your computer, It should start redirecting addresses mentioned in Hosts file (C:\Windows\System32\drivers\etc\hosts)
Note: This Solution is only for Google Chrome
Try clearing the DNS Cache:
1) run cmd.exe as administrator
2) type: ipconfig /flushdns
I just encountered this tonight and none of these options worked. I discovered that Chrome now hides "www" (https://www.howtogeek.com/435728/chrome-now-hides-www-and-https-in-addresses.-do-you-care/). Chrome was using my hosts file, but I had to add "www." to my hostname in my hosts file since that's what the browser is actually requesting, even if it doesn't show it.
A little late, but after hours i find a solution. It seems that Google Chrome sometimes has problems on recognize the name of the hosts defined en /etc/hosts.
I'm using linux and i'm behind a proxy.
Try adding at the end of the name server: .localhost
Example:
At: /etc/hosts:
127.0.0.1 myservername.localhost
On the virtual-hosts of your server configuration you'll need to rename the server name. In my case, i'm using apache so at /etc/apache/sites-enabled/myserver.conf rename the line of the old server name with:
...
ServerName: myservername.localhost
If you are behind a proxy, you can except all the hosts just adding to the no_proxy vars:
$no_proxy= "localhost"
Finally don't forget to restart the server and try to access on the browser with the new server name.
😊 simple answer 😊
there are 3 workarounds about this:
1- deleting Visited Links binary file (beauty👍)
2- using .local or .app instead of your desired TLD (standard & preferred by chrome docs but i don't like it)
3- restarting your computer (ugly👎)
deleting Visited Links binary:
kill all chrome tasks (close all chrome windows:))
delete C:\Users\[USERNAME]\AppData\Local\Google\Chrome\User Data\Default\Visited Links binary
you can define a function in your shell profile to perform this fast and just by a command whenever you face this issue: e.g:
function respectHosts () {
$path = $HOME + "\AppData\Local\Google\Chrome\User Data\Default\Visited Links";
Remove-Item $path;
}
important Note:
it is suggested that first time after deleting Visited Links binary file, also delete your history cause if you use a url from history, actually you are using the cached dns of that url too:
Running Chrome 105 on Windows 11, nothing seemed to work until I added ::1 (i.e. ipv6) in addition to 127.0.0.1. For example:
127.0.0.1 local.foo.com
::1 local.foo.com
While it was stated that no proxy is being used, I have had the same issue on OS X while using a proxy and the eventual solution was to add a proxy-exception for this domain.
What the OP could try is turn off async DNS via command-line switch as
mentioned here in 2015:
Async DNS: Remove toggle from about:flags
Async DNS is fairly stable at the moment, so we don't really need the
toggle in about:flags anymore. (Note that the --enable-async-dns and
--disable-async-dns command-line flags will still work for now.)
This, however, seems to have no effect in my case, as chrome://net-internals/#dns still displays the internal DNS-client as enabled with no obvious way to turn it off.
Had a similar issue working from a windows based server that had proxy settings. In the proxy advanced settings there are 2 options that can help. Ignore proxy setting for local hosts which is a check box; as well as a list of addresses set off my semi-colons where you can except out certain IP destinations. This fixed my issue.
For me
chrome://net-internals/#sockets
Flush socket pools work wonder, credit: https://superuser.com/a/611712

Chrome not Firefox are not dumping to SSLKEYLOGFILE variable

I'm trying to decrypt SSL packages with Wireshark as described here. I have already created a SSLKEYLOGFILE System and User variable and the log file. I have restarted my computer (running Windows 10), and opened https urls with Chrome and Firefox, but none write to the ssl log file. My Chrome version is 56.0.2924.87 (64-bit) and my Firefox version is 51.0.1 (32-bit). Any idea how can I make any of the two browsers write to that file? Or is there any way to get the SSL key to be able to decrypt SSL packages in Wireshark?
You are doing something wrong. Tested on version 58 & you do not need to reboot. To activate either:
set environment variable e.g. SSLKEYLOGFILE to %USERPROFILE%\sslkeysENV.pms
run chrome with argument e.g.:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --ssl-key-log-file=%USERPROFILE%\sslkeysARG.pms
With Firefox the features seems to be disabled by default and is only available in debug builds. With Chrome this might have been vanished by switching the underlying SSL engine from NSS (which implemented this feature and is also used in Firefox) to BoringSSL (which maybe does not have this feature).
Update: according to #Lekensteyn (see comment) the feature is again available in current Firefox and Chrome builds.
I have solved it!
You MUST be sure chrome totally be closed. And then reopen a fresh new chrome instance.
Chrome has a default options let chrome run in background enabled.
Double check your taskbar of windows or processes lists to make sure there's no chrome instance exists.
That's why --ssl-key-log-file don't working, chrome stills alive after you click exit button.
Try Firefox Developer edition, the above mentioned feature is turned on by default. I tested yesterday only.
Some antiviruses (like Avast) inject the SSLKEYLOGFILE environment variable into well-known processes like firefox.exe and chrome.exe. If you rename the browser executable file and launch that, then the environment variable won't be overridden.
Try to close your current browsing session, it behave like you just add a new path to PATH, only work from the new session and so on.
Besides what they have already pointed out, I want to show three points that may help. These are tips for Linux (CentOS)
Make sure the file that related to SSLKEYLOGFILE can be written and read, to make sure you can use:
chmod -R 777 sslkey.txt
Make sure your Firefox or Chrome is opened under the same user with the file mentioned, for example under root.
Find some useful comments here

How to clear cached javascript files using chrome as browser and nginx as webserver

I am running localhost the following code
What happens is that my browser/server appears to cache the outdated javascript file in js folder.
I have cleared my browser cache and turn on disable cache when devtools is on.
But the app.js continues to be outdated copy.
Am I supposed to do something to the nginx server?
I finally figured out why.
I am using VirtualBox and I needed to turn off the sendfile configuration.
See this for more details:
Prevent VirtualBox Guest from Delivering Cached Files
Just make sure for the relevant conf file inside the /etc/nginx/sites-available you explicitly say
sendfile off;
try setting expires -1; in your nginx location rule for js files.