Hosting Meteor apps as an client

This is a blog on my another hack into meteor. Before discussing anything just look at this URL -

The app you see is the popular meteor app telescope. And you saw it is loading from heroku? and it has the all the content of

What is happening here

This heroku app simply serve the static files related to telescope demo app. So heroku will be served as file server, nothing more. No websockets or sockjs connections will proxy through heroku.

How this works

If you skim throught the index.html you’ll see all the related js and css will be loaded from the heroku. And we’ll ask meteor to connect with telescope demo app server with DDP_DEFAULT_CONNECTION_URL runtime config property.

What are the usecases

This seems like useless at first. But this is quite powerful and we can do alot with this. Some of them are,

  • Use a CDN to serve all the static files
  • Use this as a loadbalancer by dynamically changing DDP_DEFAULT_CONNECTION_URL
  • Inject HTML/JS/CSS (see I’ve done it with a custom header)

What you guyes think about this? Do you find this useful?