focuser
focuser

Reputation: 897

Meteor.js: Is it possible to change the base path in the URL?

I would like to access the entire app using URL http://localhost:3000/theapp instead of http://localhost:3000/.

In the html source of the app built using meteor build:

<html>
<head>
  <link rel="stylesheet" type="text/css" class="__meteor-css__" href="/8b140b84a4d3a2c1d8f5ea63435df8afc22985aa.css?meteor_css_resource=true">
  <script src="/215e9bb1458d81c946c277ecc778bae4fc8eb569.js">
...

I'd like to change the base path from / to /theapp, so the above <link> and <script> tags would become:

  <link rel="stylesheet" type="text/css" class="__meteor-css__" href="/theapp/8b140b84a4d3a2c1d8f5ea63435df8afc22985aa.css?meteor_css_resource=true">
  <script src="/theapp/215e9bb1458d81c946c277ecc778bae4fc8eb569.js">

The reason for this requirement is that I'm trying to use Nginx to forward requests to different meteor apps based on the path in the URL:

http://localhost/app1  ==> http://meteor-app1
http://localhost/app2  ==> http://meteor-app2

Is this possible?

So as @d4nyll mentioned in the comment, I need to do server-level routing instead of application-level routing. Solutions such as Iron Router / Flow Router will not work.

Upvotes: 2

Views: 1413

Answers (1)

focuser
focuser

Reputation: 897

Found the answer here: http://docs.meteor.com/#/full/meteor_absoluteurl

Basically just need to set environment variable: ROOT_URL.

Upvotes: 1

Related Questions