Host update time after upload?

When I create a new build, then upload it to my host and try to access it, I get a variety of errors. But if I wait several hours and try again, it works fine. What’s going on with that? It’s got to be my host because I’ve done nothing but try again several hours later. Has anyone else experienced this?

Can’t it be a caching issue? Did you clear your browser caches?

Yes, possibly. I have it loaded in Firefox, Chrome and Edge. After uploading it, I refresh the browser, F5. That should reload the page regardless. But if someone bookmarks it and tries to return after I’ve made updates, they may get the error. What is it in the WebGL build that changes? Is there a way to keep it consistent? I never ran into this with the Webplayer. Thanks.

Hello topofsteel.
This behavior is normally controlled by the hosting server. Although you are changing the files on the server hard drive, for some period of time those files can still remain unchanged in the memory of the server proxy software, which is serving the requests. Especially this setup is quite common for html, js and css files.

First let’s check if this is the case. One possible way to easily test it is to append a unique query to the request (for example, it can be ?version=1). This will prevent loading of the replaced resource from the server/local cache. Open your game html and make the following changes:

dataUrl: “Release/mygame.data**?version=1**”,
codeUrl: “Release/mygame.js**?version=1**”,
memUrl: “Release/mygame.mem**?version=1**”,


After you upload the modified html to the server, open your page in the browser appending a unique query to it like “…/mygame/index.html**?version=1**” to make sure that you receive the recently updated html and not the cached one.

If those steps resolved the situation and you were able to get the uploaded resources immediately, then you should consider configuring your server. At least you should disable caching of the index.html, so that you will be able to control all the subsequent loading from there. In case of apache you can achieve this with the following .htaccess file put into the same folder with the index file:

<FilesMatch “.(html)$”>
FileETag None

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”

During the game development you can disable caching of the js files as well with <FilesMatch “.(html|js)$”>, however, the released js files should be still cached for better user experience. If you don’t have direct access to the server software, you can control the caching with htaccess. If you are not able to use htaccess, then you can just rename index.html into index.php (this should normally prevent its caching) and update the version queries in that index.php.

EDIT: if the server provides Last-Modified and/or ETag headers for the content files and enforces revalidation, there should normally be no issues with the content update.

1 Like

@alexsuvorov That’s great information! I switched projects and i’m just getting to the point where I’m testing builds. I disabled the caching globally on the server and it seemed to have fixed the problem. I will look into controlling it with the .htaccess file. Thank you!

Hi @alexsuvorov
I try your solution to modify the index.html in unity5.3.4
dataUrl: “Release/mygame.data**?version=1**”,
codeUrl: “Release/mygame.js**?version=1**”,
memUrl: “Release/mygame.mem**?version=1**”,

But it will give error when request the index.html.
I found the error was due to the data,js,mem was in gz format in unity5.3.x.
So the file extension will be mygame.datagz not mygame.data.
When UnityLoader.js try to add ‘gz’ in the tail of the file name,it will become “Release/mygame.data**?version=1gz”**
which cause the error.
Is there any solution we can try when we want to force the client not using cache ?
Because sometimes we found the client was caching the old version of js and not matter how client was reloading the page,
it still don’t download the new one.
thanks!

You can modify the index.html like this


when you build your app,
・create the new version folder (eg. 3)
・push “Release” into new version folder.
・update index.html (eg. var version =“3”; )

Hello PCChen.

Oh, yes, you are right, I did not consider this case. Still, this is just something that you can use to test the caching issues, it is not supposed to be used in release or production builds, so you can just test the server using development build which will not involve gz suffixes. If it is confirmed that the user errors are indeed caused by the cache related issues, then you should configure your server properly to fix this. Provide more information about what kind of server you are using (apache/iis) and the level of access you have to the server configuration.