question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BaseURL other than / makes troubles

See original GitHub issue

@GavinJoyce we host our ember app in a subdirectory called /app, when I use Ember-Href-To the links does not work, because Ember-Href-To resolves the links to /app/app. We are using Ember-CLI and our environment.js looks as follows:

module.exports = function (environment) {
    var ENV = {
        environment: environment,
        baseURL: '/app/'
        // ...
        // ...
    }
    return ENV;
}

I solved it by making my own helper based on Ember-Href-To. The helper looks as follows:

import Ember from 'ember';
import { hrefTo } from 'ember-href-to/helpers/href-to';

export function hrefToX(params/*, hash*/) {
    var url = hrefTo(params);
    var baseURL = APPENV.baseURL.replace(/\/$/, ''); // APPENV is globally available... jeah this is a relict from our old code from ember-cli 0.0.39
    url = url.replace(baseURL, '');
    return url;
}

export default Ember.Helper.helper(hrefToX);

It works but if I hover the links built with hrefToX the links dont contain the /app/. This does not happen with link-to. Is my solution the right way to go or is there a better way to do it?

Thanks a lot

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
rwjbluecommented, Apr 27, 2016

baseURL is going to die 🔥 🔥 🔥 🔥 🔥 🔥 . See https://github.com/ember-cli/ember-cli/pull/5792 and a blog post we are working on in https://github.com/emberjs/website/pull/2569.

0reactions
nathanhammondcommented, Mar 21, 2018

baseURL is dead as of 3.0. Nominate for closure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BaseURL Problem: Cannot Change It – YouTrack Support
I removed everything in <username>\teamsysdata to reset the database and then restarted YouTrack. Now it works fine. 0.
Read more >
android - Retrofit - Change BaseUrl - Stack Overflow
For some WebRequests , I must call the same API but on others, I must call it from a completely different BaseUrl ....
Read more >
The Document Base URL element - HTML - MDN Web Docs
The HTML element specifies the base URL to use for all relative URLs in a document. There can be only one element in...
Read more >
Cannot find a valid baseurl for repo : base problem
Set proxy information in the /etc/yum.conf, like this: proxy=http://xxx.xxx.xxx.xxx:1087 proxy_username= proxy_password=.
Read more >
JIRA Displays an Error Banner about the Base URL | Jira
Click here to fix this problem.". ... Make sure that the base URL is correctly set and this same address is reachable from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found