Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

paulThorpe's avatar

Forge/digital ocean serving old files

I have had this problem a few times now, and Im not totally sure if this is a problem with forge or digital ocean.

Ive got an app n angular2 on the frontend and laravel in the back. The client facing app is in angular2 and the api/administration area is in laravel/php

on pushing file changes to github i have manually, and automatically deployed my site through forge to digital ocean. the files that are being changed are ts/js files. for the most part. the problem is when i ssh into my server i can see that the files are in sync with my git repo, but the changes are not updating my server.

Doesnt the server read from these same exact files? I just cant wrap my head around it. The app is not behaving in a way that reflects my changes and if i inspect the js file in the console i see very old code.

I have had this problem several times now with this project and I have completely rolled back migrations and removed the whole site from my server. upon re-uploading i still get the same old files being served. Last time this happened and i was in a time crunch I completely deleted the server and started fresh and that fixed my problem. It just seems kind of dumb to keep making new droplets on digital ocean and then creating new passwords and redoing my ssh keys.

honestly do not believe this is forge, considering the files on my server are there in the correct form. but if anyone else has had this issue please let me know. I can deal with it anymore, whatever the culprit it has to be replaced with a non faulty solution.

0 likes
5 replies
willvincent's avatar

Browsers cache javascript files locally by default, so unless you include a cache-buster (get param) on the script src, or can otherwise enforce that files not be cached, you'll run into this issue until you force refresh your browser.

Sounds like this is most likely your issue since the problems you're having are client side javascript related.

2 likes
GwynBleidd's avatar

To elaborate on 'cache-busting', basically, to do that, you can add any random string as a GET parameter, so just to check if it's your issue, replace

<script src="script.js">

with

<script src="script.js?<?php echo time();?>">

and see it that helps.

If it does, then you can further play with caching with .htaccess if it's Apache:

<filesMatch "\.(js|css)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
  <ifModule mod_expires.c>
     ExpiresActive Off
  </ifModule>
</filesMatch>

(that's like extreme no-cache-ever thing, you do NOT want to do that on production)

Or something like this in conf if it's nginx:

location ~* \.(?:css|js)$ {
  expires off;
}

but then if gulp and elixir are used with versioning, this problem doesn't exist at all.

jekinney's avatar

If you complie with elixir you can use versioning (cache busting).

@GwynBleidd though your php time will work it will work to well. Ie every page load will d/l a new version and thus cache will not be used. Probably not a good idea with larger files.

GwynBleidd's avatar

@jekinney That's why I suggested to use it for checking, and suggested using elixir versioning :-)

1 like

Please or to participate in this conversation.