I've learned something the hard way recently — caching can be both your best friend and your worst nightmare. One day, everything on my website was lightning-fast. The next day, every single js-dos game just… died. No warning, no clues — just a cryptic WebAssembly error that sent me down the rabbit hole.
Here's what really happened, how I fixed it, and what you should probably check if your own site suddenly decides to rebel after a caching tweak.
The Day Everything Went Boom
So I'd just finished polishing my .htaccess
setup — tightening LiteSpeed rules, improving browser caching, and doing all those good things that usually make Google's PageSpeed smile.
Then I visited one of my js-dos game pages… and instead of loading the DOS prompt, the console screamed:
That's developer-speak for: "Your WebAssembly loader and binary aren't talking anymore."
But here's the weird part:
Same HTML, same JS, same WASM. Only the environment changed.
At that point, I knew this wasn't about broken code — something was cached wrong.
When Caching Gets a Little Too Smart
Now, here's what actually happened behind the scenes — and it's a classic case of "optimizing too far."
When I added those LiteSpeed caching lines like:
it basically told browsers and LiteSpeed servers:
"Hey, these files are perfect. Never check for updates. Ever."
by Author
That's fine for images or CSS that rarely change. But for something dynamic — like my emulator's js-dos.js
, emulators.js
, and emulators.wasm
— that's dangerous.
Here's how things spiraled out of control:
It stored them in memory and served them to every request.
It compiled the old WebAssembly and kept the compiled result inside its internal cache.
.htaccess
and re-uploaded new emulator files.But both LiteSpeed and Chrome said, "No need to re-download — we've got them cached forever!"
js-dos.js
tried to call a function that didn't exist in the old .wasm
, leading to that infamous "Import #300 requires a callable" error.So it wasn't really Chrome's fault — it was following instructions too well. The real blame goes to over-aggressive caching.
Figuring Out the Puzzle
The debugging process was hilarious in hindsight, but painful at the time.
I checked:
Still, nothing worked.
Then, out of curiosity, I opened the same page in Chrome Incognito — and it worked instantly.
That was the "aha" moment.
Incognito doesn't use the existing cache, which meant my actual files were fine. The problem was the stale cached versions LiteSpeed and Chrome were holding on to.
The Real Fix: Teaching LiteSpeed Some Boundaries
The solution came down to rewriting a few lines in my .htaccess
— telling LiteSpeed and browsers to treat my emulator files differently.
Here's what I added:
Header always set Pragma "no-cache"
Header always set Expires "Mon, 01 Jan 1990 00:00:00 GMT"
RewriteRule (js-dos(\.min)?\.js|emulators\.js|emulators\.wasm)$ - [E=Cache-Control:no-cache]
AddType application/wasm .wasm
SetEnvIfNoCase Request_URI "\.wasm$" no-gzip=1
That little block basically says:
"Never cache or transform these specific files. Always fetch them fresh."
by Author
After saving and restarting LiteSpeed, I refreshed my site — and everything loaded instantly again.
The DOS screen came back to life.
But Chrome Still Had One Last Trick Up Its Sleeve
Even after fixing LiteSpeed, my regular Chrome browser still threw the same error.
The reason? Chrome had already cached the compiled WebAssembly binary inside its hidden code cache.
No matter how many times I hit refresh, it kept using that bad cached version.
The only solution was to wipe everything:
- Cookies and other site data
- Cached images and files
- Site settings
Once done, everything worked — even on normal Chrome.
So yes, sometimes "clear your cache and cookies" really is the answer.
What I Learned (The Hard Way)
Your emulator JS or WASM files need different caching behavior than your CSS and images.
It's insanely fast, but it will cache literally anything unless you tell it not to.
The loader and binary must match byte-for-byte — even a small mismatch causes runtime failure.
It just followed the cache headers you gave it — and stored the bad code perfectly.
The Takeaway for Developers and Site Owners
If you're running js-dos, Emscripten builds, or any kind of WebAssembly-powered app under LiteSpeed or Cloudflare, keep these golden rules in mind:
.wasm
and .js
loaders).application/wasm
MIME type.Do this, and your games (or any WebAssembly app) will stay stable, even under aggressive caching systems.
Final Thoughts
This whole issue taught me that "faster" doesn't always mean "better."
Caching is great — until it starts serving ghosts of your old code.
By fine-tuning your .htaccess
and knowing when to tell LiteSpeed "no", you'll save yourself hours of head-scratching later.
If you ever find yourself staring at the dreaded
don't panic.
The fix might just be a few cache headers — and maybe one brave click on "Clear cookies and site data."