skip to Main Content

I am on a Linux shared hosting server. It has been a problem since day one that my code updates don’t get reflected. The browser keeps rendering the result from the code that has been updated. I tried to clean the cache but it didn’t help. Also, I tried to run the code from Edge, Chrome, and Firefox. Only Firefox recognized part of the updates but Edge and Chrome would totally ignore them. I had the same problem while running on localhost. I either had to wait for a period of time for the old code to be flushed or keeping flipping file names. It looks to me the old codes don’t get flushed out right away. Anyone else has the same experience?

2

Answers


  1. Well, provided you are using NGINX as the web server of choice, it is possible to modify the way code updates are applied, here is a configuration that will apply any code updates you make instantly no matter what:

    server {
        # OTHER CONFIG
    
        add_header Last-Modified $date_gmt;
        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
        if_modified_since off;
        expires off;
        etag off;
    
        # OTHER CONFIG
    }
    

    If NGINX is not the server you’re using and you’d like to learn more about it, I’d recommend going to https://landchad.net It’s a great website that describes how to set up an NGINX instance in a very beginner-friendly way.

    Login or Signup to reply.
  2. I have this issue with Chrome and Firefox this sounds like a browser cache issue…
    I have to keep clearing my browser history data to force the new data to appear.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search