Cloudflare breaks hot code reload?


#1

Trying to debug a weird issue that occurs when I re-deploy my Meteor site using Meteor Up on CloudFlare. Everything mostly works as expected, but when the page tries to refresh, I end up getting a blank all-white page. Refreshing doesn’t always fix the issue.

Digging into the console reveals that the page is trying to load a file called 09338467ad5dd58644da28df786ec00be4172b5a.js. Loading this file pulls up my site’s 404 page, as rendered by Iron:Router. From what I can tell, the page is trying to load a Javascript file, but gets the HTML from the 404 page, and then chokes because it was expecting Javascript.

Purging the Cloudflare cache or setting it to development mode resolves the issue, but I’d ideally like to avoid doing that every time I deploy. Anyone have any suggestions?


#2

not sure if this solves your problem but did you review:
https://meteorhacks.com/cloudflare-meets-meteor.html


#3

Yup, took a look at Arunoda’s post already. I’ve already turned off everything he mentions (Rocket Loader, HTML caching, websockets). Still running into this issue.


#4

you try asking him? Post to that meteorhacks article. good chance he’ll reply!


#5

@arunoda, any ideas?


#6

That may be a caching issue. Try to purge cache.


#7

That’s really about it… Unless there’s a way to tell Meteor to call up the Cloudflare API to flush the cache for first time runs?


#8
Here is an example POST to the fpurge_ts action for purging the cache for example.com:

curl https://www.cloudflare.com/api_json.html \
-d 'a=fpurge_ts' \
-d 'tkn=8afbe6dea02407989af4dd4c97bb6e25' \
-d 'email=sample@example.com' \
-d 'z=example.com' \
-d 'v=1'

although better for performance if it’s possible to identify and purge only the blocking files

Here is an example POST to the zone_file_purge action for purging the cache for example.com:

curl https://www.cloudflare.com/api_json.html \
-d 'a=zone_file_purge' \
-d 'tkn=8afbe6dea02407989af4dd4c97bb6e25' \
-d 'email=sample@example.com' \
-d 'z=example.com' \
-d 'url=http://www.example.com/style.css'

I guess if you wanted to get fancy you could purge on commit to your repo? that way you’re only purging changed files haha


#9

hmm… no way to just purge js and css files no?


#10

only one by one it seems, but you could certainly script it! or if you upgrade i think you can set them to auto expire more frequently