304 not modified error Steps to fix it









HTTP 304 not modified error is a status code which indicates that that the requested resource has not been modified since the previous transmission.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix HTTP related errors.

In this context, we shall look into the main causes and solutions to this error.


Nature of 304 not modified error?

The 304 error indicates a communication problem between a user’s browser and server.

This message tells the browser that the resources cached in the browser have not been modified since the previous transmission. Thus there is no need to retransmit the requested resource to the client again. As a result, the browser displays a cached version of the web page.

Sometimes, this status code is shown when if it is not supposed to return this result. 

It can happen in the following cases:

i. Server configuration or Domain Name Server (DNS) issues.

ii. Infected or corrupted cached resource.


How to fix the 304 not modified error?

Apply the following tips to resolve this error.


1. Check server configurations and redirects

The 304 response codes could trigger due to incorrect redirect instruction present in the server configuration. For the Apache web server, it would be a good idea to cross-check the redirect rules in the .htaccess.

Check for the line starting with “mod_cache” in this file.  We can try commenting out those lines to see if it fixes this error. Also, look for similar redirect codes in the Apache configuration file under mod_cache.c section like the one given below:

LoadModule cache_module modules/mod_cache.so
<IfModule mod_cache.c>
    LoadModule cache_disk_module modules/mod_cache_disk.so
    <IfModule mod_cache_disk.c>
        CacheRoot "c:/cacheroot"
        CacheEnable disk  "/"
        CacheDirLevels 5
        CacheDirLength 3
    </IfModule>
    # When acting as a proxy, don't cache the list of security updates
    CacheDisable "http://security.update.server/update-list/"
</IfModule>

 For Nginx websites, look for the expires directive within the nginx.conf file. This define when the cached versions should be refreshed from the server. A sample one looks like:

map $sent_http_content_type $expires {
    default                    off;
    text/html                  24h;
    text/css                   24h;
    application/javascript     max;
    ~image/                    max;
}
server {
    listen 80;
    listen 443 ssl;
    server_name www.example.com;
    expires $expires;
}

We could temporarily disable this directive by commenting out those lines.


2. Using a Public DNS

The 304 error can happen due to an incorrect DNS address. Thus a possible method to fix this error would be to use the Google Public DNS.

On Windows, we can perform it from the Network connections window. 

i. Here, locate the network connection you’re using and right-click on it.

ii. Next, select Properties and double-click on Internet Protocol Version 4.

iii. Select the option to “Use the following DNS server addresses”, then enter the value “8.8.8.8” under Preferred and “8.8.4.4” under Alternate. 

iv. Finally, we need to restart the system to apply the changes.


Sometimes, flushing the DNS cache can help also help us to fix this error


3. Perform a malware scan

Corrupted browsers are another common factor that may trigger this error. Thus it is recommended to run a malware scan on the browser if we unexpectedly receive the 304 status code.

Windows version of Chrome has a Malware Scanner and Cleanup Tool that comes built-in. The cleanup can be performed from the URL “chrome://settings/cleanup”.


Hit Enter, and then next to Find and remove harmful software click on the Find button. The scanner will begin running, then report back with the results.


For other browsers, we may use an antivirus program in the server to perform the scan as they do not have an inbuilt one.

It is possible for the browser’s extensions to become infected and interfere with requests and server communication. Thus we could also try disabling them to see if it fixes the error.


We could also try clearing the browser cache as it helps us to sort out this problem at times.


4. Debug Application Code

Another possible reason for this error is some custom code within the application. We may need to manually debug the application, along with parsing through application and server logs.


[Need urgent assistance in fixing HTTP errors? – We're available 24*7. ]

Conclusion

An #HTTP 304 not modified status #code means that the website you're requesting hasn't been updated since the last time you accessed it.

Basically, your browser will save (or cache) web #pages so it doesn't have to repeatedly download the same information. This is an attempt to speed up page delivery. However, if this happens to your site, #visitors could be prevented from accessing your #web pages.