I recently deployed a meteor app using the following command:
$ meteor deploy example.com
and later (thinking that it was the same) using t
Okay guys, I found a simple way :
If you want www to redirect to non-www you can use this method. You can also modify the code a little to do it other way around.
Simply set
@ (CNAME) : origin.meteor.comm
www (CNAME) : origin.meteor.com
Then, deploy your main app (without www).
meteor deploy yourapp.com
Now, create a new meteor app called redirect with
meteor create redirect
cd redirect
Set the generated js file contents like this :
if (Meteor.isClient) {
var url = document.URL;
url = url.replace("www.", "");
window.location.href = url;
}
Then deploy your redirect app (with www)
meteor deploy www.yourapp.com
What you did is, you deployed two different applications to www and non-www of your domain. All the meteor app at www does is to redirect you to non-www domain. It will also redirect www.yourapp.com/some/path to yourapp.com/some/path. Simple yet powerfull solution :)