DNS (Domain Name System) are an "index" that associates domain names with their public IP, when you call up a web page with the browser, the operating system and the browser store the information in their DNS cache at the first access, this in order to load the websites already visited more quickly without having to query the DNS servers at each access and have from them the correct public IP to which to route the request.

Why clear the DNS cache?

Unfortunately this leads to problems, some related to security, a malware can corrupt the DNS cache and route requests to malicious sites (phishing), but in most cases the DNS cache can become obsolete and create navigation problems. In the case of highly dynamic and complex sites such as an ecommerce in PrestaShop this can cause problems especially for those who log in frequently. It can happen in the case of use of CDNs or changes at the domain level that problems occur with CSS and JavaScript or even the website is unreachable. These are rare events and due to changes by the providers. These events are temporary because even without any intervention the DNS cache will be renewed upon expiration, but if we are the administrator of an ecommerce and we need to log in immediately following a change in the DNS, perhaps following a move of the website to another hosting or in the event of an incident to a new server, it will be necessary to manually clear the DNS cache to speed up the process.

IP Failover

One solution to the DNS cache problem is to use its own public IP, which can be quickly moved from one server to another in the event of an incident. However, this is only possible within the same network infrastructure, it is not possible, as with domain names, to migrate an IP from one provider to another.

Use a VPN

A VPN can not only be useful for increasing security, especially when we use public internet connections, but a professional resource for testing and managing your ecommerce. We recommend the use of Avira's Phantom VPN which will allow us to simulate visits from abroad to test any geolocated services.

How to clear DNS cache on Windows, MAC, Linux and Chrome?

Flushing the DNS cache is a fairly simple procedure, but each operating system has a different way to do it. It is also necessary to check if it is sufficient to delete it from the computer or if it is also necessary to empty it in the browser. This procedure is valid when we talk about changes at the DNS level, for example the change of the IP of the MX server or A record, but in the case of a real change of the DNS the cache of the provider is added in addition (internet connection) , in this case you have to wait for the DNS routing (24 / 48h) or change the DNS of your Internet connection with those of Google (8.8.8.8 and 8.8.4.4), OpenDNS (208.67.222.222 and 208.67.220.220) or using a VPN in order to bypass the DNS cache of our connection, and access our ecommerce almost immediately without waiting any longer.

Clear the DNS cache in Windows 10

To clear the windows cache you need to open the command prompt: Start -> Windows System -> Command Prompt

Once the console is open we enter the command line:

ipconfig / flushdns

ipconfig flushdns

In the other versions of Windows the command is always: ipconfig / flushdns , but change the way in which to embroider the CMD, given that Windows XP and 7 should not really use it especially at a professional / corporate level, not only for the purposes of the GDPR, but for your own safety. In Windows 8 you need to open the APP screen and then on the right look for Windows System (or Windows System) and select Command Prompt.

How to clear Google Chrome DNS cache?

To clear Chrome's DNS cache simply enter the following command in the address bar: chrome: // net-internals / # dns and then click on Clear host cache

Clear browsing data in Chrome

Once the DNS cache has been cleared, we should also clear the navigation cache where the files downloaded locally are contained to speed up navigation, to do it in chrome there are various methods:

  • Menu (the three dots) select the item Other Tools and then Clear Navigation Data, we can also use the quick keys Ctrl + Shift + Del on Windows or cmd + shift + backspace on macOS
  • By installing a Chrome extension: Clear Cache , highly recommended when administering your own ecommerce or website, in order to check correct loading after new changes. The cache may not only not show the last change, but hide problems introduced with it.

Other very useful extensions when managing your own e-commerce in PrestaShop are:

  • EditThisCookie , allows you to delete cookies in order to view PopUps set to be seen only once or in case of problems with login and carts during any tests with different users.

Notes : the navigation cache requires us to design and study the changes in a targeted way avoiding improvising and continuing to make structural changes, such as new modules and features or removing already activated functions, especially when the modified code is client-side such as JS script . For example, if we decide to no longer ask customers to confirm the terms and conditions of purchase, those who locally in the cache have the old setting if they do not reset the cache will not be able to complete the order anymore, because the recalled JS will not be the same. new provided by our server, but the old one still locally on the client's computer. When it comes to an ecommerce, everything must be planned and considered.

What if the customer has a problem?

What is explained in this article may also concern your customer, in the case of the DNS cache it is a very rare thing and that usually is resolved without performing any operation (unless it is corrupted by a problem on the user's PC). But the browser side cache is often a source of problems, in case a customer is unable to complete an order, view the couriers or receive errors with the payment methods, the first advice to give is to change the browser they are using or cancel. the cache of the same.

The problem is much more pronounced when the PC is shared without subdivision of users, a common case in domestic users, where all enter with a single user.

If the customer then comes from a link on Facebook opened within the mobile APP, the cache of the same also takes over.

How to clear DNS cache in Firefox?

Firefox also has a simple trick to clear the DNS cache, just enter the command in the address bar: about: networking # dns

FireFox will also show us the data of the DNS cache present and the expiration of the same.

How to clear DNS cache in macOS?

As for Windows it is necessary to open the command line interface, in macOS it is Terminal, but the procedure changes from version to version of the operating system. If you don't know the version of your macOS click on the "apple" icon in the upper left, and select "About this MAC". The first version in the list will be your current version of the operating system.

  • macOS Leopard (10.5), type the command in the Terminal: sudo lookupd -flushcache
  • macOS Snow Leopard (10.6), open Terminal and enter the command: sudo dscacheutil -flushcache
  • macOS Lion (10.7), Mountain Lion (10.8), Mavericks (10.9), macOS El Capitan (10.11), Sierra (10.12), High Sierra (10.13), Mojave (10.14) and Catalina (10.15) to open the terminal go to Go -> Utilities and enter the command: sudo killall -HUP mDNSResponder. Confirm the operation by entering your PassWord.
  • macOS Yosemite (10.10) the procedure to open the Terminal is always the same, never the command is: sudo discoveryutil udnsflushcaches . Confirm the operation by entering your PassWord.

How to clear DNS cache in UBUNTU?

Surely one of the simplest and most versatile Linux distributions for use as a desktop, also excellent in the Server environment, clearing the cache is a simple operation and very similar to that which takes place in Windows and macOS. The first command we can use is: sudo service networking restar t, which will restart the network card, not recommended especially if we are on a server, block network services.

If we cannot restart the network services, the command dns-clean which is installed by default starting from version 10.04 will help us, so the command: sudo service dns-clean start will be sufficient to clear the DNS cache without stopping the services of network.

Author: Loris Modena

SENIOR DEVELOPER

For Ind Loris Modena , owner of Arte e Informatica , he began working in the IT sector in 1989 as a system engineer in charge of the maintenance and installation of IT systems. He started programming for the web in 1997 dealing with CGI programming in PERL and then moving on to programming in PHP and JavaScript. In this period he approaches the Open source world and the management of Linux servers.

Product added to wishlist