Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate route paths relative to ROOT_URL parameter #848

Open
petermikitsh opened this issue Sep 22, 2014 · 7 comments
Open

Evaluate route paths relative to ROOT_URL parameter #848

petermikitsh opened this issue Sep 22, 2014 · 7 comments

Comments

@petermikitsh
Copy link

When running my meteor app in production mode, my ROOT_URL is defined as www.mysite.com/prototype.

My router file is defined as such:

Router.map(function routerMap() {

  this.route('index', {
    path: '/',
    template: 'index'
  });

});

When going to www.mysite.com/prototype, I get a Exception in defer callback: Error: Oh no! No route found for path: "/prototype" error.

The route path should be evaluated as / instead of /prototype because the ROOT_URL includes /prototype.

@meule
Copy link

meule commented Sep 28, 2014

I have the same issue

@tmeasday tmeasday added this to the Icebox milestone Oct 18, 2014
@tmeasday
Copy link
Contributor

Hi guys, IR does not currently support this.

Potentially you could use a middleware in IR1.0 to re-write the URLs to achieve what you need. Not sure.

@cmather
Copy link
Contributor

cmather commented Oct 18, 2014

This is on my radar. Need to think about whether/how the middleware mount option might support this.

On Oct 17, 2014, at 5:16 PM, Tom Coleman [email protected] wrote:

Hi guys, IR does not currently support this.

Potentially you could use a middleware in IR1.0 to re-write the URLs to achieve what you need. Not sure.


Reply to this email directly or view it on GitHub.

@meule
Copy link

meule commented Oct 19, 2014

@cmather did you try the middleware option?

@bryankennedy
Copy link

There's some discussion of this issue in #154 as well.

@johipsum
Copy link

johipsum commented Aug 6, 2015

I modified the URL.parse function within the Iron:URL package. now it uses the meteor runtime variable ROOT_URL instead of sticking the root url together by itself. Pull request => iron-meteor/iron-url#17

@BernieSumption
Copy link

I hit this issue too. I have a temporary fix in the form of the following monkey patch hack which is working for me, but an official fix would be nice

// note: this hack will cause issues if any of your routes are expected to contain
// the same string used in your ROOT_URL_PATH_PREFIX, e.g. if you
// have the url http://yoursite.com/prefix/url/that/repeats/prefix/
(function() {
    Iron.Url._oldParse = Iron.Url.parse;
    Iron.Url.parse = function(url) {
        if (__meteor_runtime_config__.ROOT_URL_PATH_PREFIX) {
            url = url.replace(__meteor_runtime_config__.ROOT_URL_PATH_PREFIX, "");
        }
        return Iron.Url._oldParse(url);
    };
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants