Search code examples
node.jsmeteormeteor-accounts

Running meteor application with a custom url


Some meteor packages need to know the absolute url of the running application. For example the accounts-google or accounts-facebook needs to know the url to correctly set the oauth redirect. If not set correctly (ie. to match the one configured in the social provider) the oauth flow fails.

If I run meteor the url is set to 127.0.0.1 by default. How can I change it?


Solution

  • I have found 2 solutions:

    I think that the first solution is the more flexible. You can run your application using:

    export ROOT_URL='http://yourcustomurl'
    meteor
    

    If using Cloud 9 you can create a run configuration where you can specify any environment variable, probably something like ROOT_URL='https://yourcustomurl.c9.io', and then run:

    meteor --port $IP:$PORT