Ember app (discourse!) + reverse proxying + pre-pend string to all URLs


Hi all,

I am new to Ember and I have a deployment question.

My server infrastructure is the following:

I have a frontend server (FE) that advertises the URL for an Ember web application named “baloo” at the URL http://foo.com/baloo (names are made up).

FE then redirects all http queries to a backend server (BE), where the webapp is actually hosted. BE serves the baloo app with root URL “/”.

For the whole thing to run smooth, pages served by FE should contain only links based at “/baloo”.

(Which is to say: I do reverse proxying via FE to BE).

Apache has a couple of modules to handle this problem, as long as the “/”-based links served by BE are hardcoded in HTML; if links are dynamically generated by javascript code, I need to tell BE something about the final URL where the app will “go out”, so BE can cook its javascript accordingly.

Well, it is not clear to me if an Ember app can support this setup; I am actually trying to deploy an app called “discourse”, a rails forum ( discourse.org ). [EDIT: lol, just noticed that this forum is discourse-powered]

I did some thinkering myself, but I ended up confusing the Ember routing mechanism. I found no way to tell Ember "just pre-pend /baloo to all your links, but do not use /baloo as part of your routing path".

The other solution I can think of is to setup a subdomain, like http://baloo.foo.com and serve the app from there. But I have to learn DNS :- ) [EDIT: which is what is done in the deployment of this very forum]

Cheers, Giovanni


I’m having a hard time understanding the question, but this sounds a lot like Ember.Router’s rootUrl property. http://emberjs.com/guides/routing/#toc_specifying-a-root-url


hello @jasonmit, thanks for trying ot understand my problem. First off, sorry for letting this go cold. No surprise you had troubles reading my question, I also have problems in understanding what I need.

I was about to install an Ember “hello world” app and provide a minimal example of my problem, but that would take me a while and I’d first like to check if we’re on the same page,

So please let me ask you the following:

If I say “reverse proxying”, as described at http://en.wikipedia.org/wiki/Reverse_proxy and more apache-specifically at http://www.apachetutor.org/admin/reverseproxies , does it ring any bell to you ?

[continuing in next reply because of number of links limitation]


[… continued from previous message because of num of links limitation]

With Discourse (Ember app, also the forum hosting this thread) I have exactly the problem that mod_proxy_html aims to solve, http://httpd.apache.org/docs/current/mod/mod_proxy_html.html .

the issue is that when the links to rewrite in the “Front End namespace” are js-generated, things get really tricky. I asked this to the httpd mailinglist http://markmail.org/thread/vgmng2usj33ckely and Nick Kew (author of mod_proxy_html) gave me an answer that… is quite difficult, if not impossible, to apply in the general case.