With the location: ‘history’ option, it seems we have two limitations:
We have to specify the ‘rootURL’ in router as the hardcoded context path of the app - there may be alternatives like finding the URL fragment from window.location.href to find the context path or if you use JSP, find pageContext.contextPath, but why is this needed by this feature in first place or is there an alternative? Otherwise, it does not seem to recognise the index route of the app itself.
Every other route other than the index router taken by the app when using this location: ‘history’ option, results in a URL like http://host:port/app_name/route where this URL appears in browser, but this URL on refresh results in a 404. So if this URL is accidentally bookmarked by end user, it may later show a 404. Am I missing something here, for all these tests, (I use RC 1 in my local dev box)? But I have a sample here that is supposedly built with ember RC 3.
Looking for some pointers/guidance from the forum members,
Hi,
I don’t know if I am missing something, but can’t we have a standalone simple web app without a Rails backend? I have one such fully standalone web app, that does not have a direct backing Rails server, but instead has modular REST services providing data for the UI (Ember does not come into the picture of those REST endpoints at all) So how do I have a catch all route for such a scenario?
You don’t need to be using a rails backend, but your server side wether it be a framework like rails, or a simple apache server has to be setup so any route to your app serves up the same content.
This post has an example Apache rewrite rule that would redirect all routes to an index.html file.
*edit I kept tyring to post a link to a similar question on the forums, but the link doesn’t work right. Someone else posted a similar link so I’m removing it
Thank you all for the information on URL rewrites. I tried UrlRewriteFilter but can any of you let me know how to write rules for my Ember app? If I just have the one rule to redirect all “/*” requests to “%{context-path}%”, it does not work and seems to append lot of unnecessary characters. Any pointers will be of great help.