- Home /
Browser-side WebPlayer application caching.
Hi... I've been trying to solve this for two days now, and I still can't figure it out!
I'm building a WebPlayer application, served inside a really simple web page. The thing is, I can't get the web player file to cache on the browser side. I'm using Amazon S3 to store the built *.unity3d file, and it has all the appropiate caching headers:
Cache-Control: max-age=2592000, public, must-revalidate
Nevertheless, each time I open the web page, the whole file is transferred, and it takes about a minute to do so. This is time consuming and costly.
What am I missing? I know this can be done because The Hobbit's game does it. The first time I load the web page, 20MB are transferred, but in future requests, only about 30KB are transferred.
If anyone needs to know, this is the uploaded file:
https://s3-sa-east-1.amazonaws.com/combo-combat-release/WebPlayer.unity3d
Thanks for your time and knowledge!
Manuel
Answer by Graham-Dunnett · Jan 17, 2013 at 11:40 AM
$ curl -I https://s3-sa-east-1.amazonaws.com/combo-combat-release/WebPlayer.unity3d
HTTP/1.1 200 OK
x-amz-id-2: xKOLzWwPD1pboYXJVuQbnCdMcng8D75f5WQIRJANmlIXAxX+OmxHyHaeu0GrhzQy
x-amz-request-id: BE6B915D2EB62ACC
Date: Thu, 17 Jan 2013 11:28:47 GMT
Cache-Control: max-age=60, must-revalidate
Last-Modified: Wed, 16 Jan 2013 23:10:40 GMT
ETag: "c2d9e81f13d34a281866c787d0d93628"
Accept-Ranges: bytes
Content-Type: application/octet-stream
Content-Length: 5936722
Server: AmazonS3
So after 60 seconds the file will need to be re-fetched from the server?
That was me twiddling with the parameters. From what I understand, though, max-age combined with must-revalide and ETag force the client to ask if the ETag has changed after 60 seconds, not necessarily re-fetch it. Thanks for the answer
Answer by maraoz · Jan 17, 2013 at 12:32 PM
I haven't been able to solve it yet. Anyway, I think I've got the reason:
I tried the same headers with a smaller (5MB) file, and everything worked. It got cached, the browser sent the If-None-Match, and the server responded with a 304. I think the file exceeds the maximum cacheable size in a browser for a single file.
So, the solution is to use streamed content, or make a Desktop client.
Anyone can confirm this? Is this why streamed content was invented? :P
Your answer
Follow this Question
Related Questions
Web Build Loading Slow 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
WWW Request runs in Editor but not in Webplayer 1 Answer
Loading data from a different game 1 Answer