I am very new to web development and if I am doing something hilarious then please excuse me.
I am a mobile game developer and I have made an html game as a demo for the users who want to get a taste of the game before purchasing my game. And for hosting the game, someone suggested me netlify as it is a champion in the field of web-hosting. But truly speaking,my experience with netlify was very “Painful” (although the deployment was as simple as drag and drop)
My story goes below:-
In my game, there are many different types of file (example like html,css,png,txt). Most important files are text files (.txt) which contain information about game’s level. But the issue is “when the game loads all the files,it simply does not caches them”. Because of which when the game is played, it always tries to fetch the file from the online server which causes lag in the game. And in some critical area because of the lag,my game crashes
So I did a small research on the net and to make the game “cache” all the files, I made a file named “netlify.toml” , and entered the given data:-
for = “/*” # This defines which paths this specific [[headers]] block will cover.
Cache-Control = “public, max-age=1800”
And then saved it in the main directory and then I uploaded my game again.And it solved my issue.Now the game files were getting cached.And the lag in my game disappeared. And I tested my game many times to confirm that whether my issue got solved or not
But my success was short lived
After 3 hours,I just tested my game again, and now again my game was not “caching” the files. It seems that netlify just simply forgot what I did earlier.And my game is lagging again
So,please someone help me on this issue. Thanks in advance