I created a plain vanilla app using ember-cli v 3.0.0 and added a route to it. When I build the app and serve it using ember-serve, all routes are loaded successfully. However, when I change working working directory to dist and serve it using http-serve, none of the routes load.
Is there any specific configuration required for serving the app through http-serve (or any similar web server)?
The app is on public repo at GitHub on https://github.com/shubmittal/testemberapp.git
So my guess is you’re running into the locationType thing. Basically… there are several ways an Ember app can be configured in regards to URL format. The default is “auto” which uses the “history” setting first, if supported by browser, and falls back to “hash”. History uses urls of the form
<app server>/<route-name>. This often confuses webservers however, because instead of loading the route within the single HTML file as it’s supposed to, it makes a request to the
<route-name>/index.html location on the webserver which doesn’t exist.
The easiest and safest way to fix this in most webservers is to change
ENV.locationType to “hash” in your
environment/config.js. This will change your urls to the form
<app server>/#/<route-name>. However depending on the web server and how you configure it you can get it to work with the ‘history’ setting as well, it’s just more work.
I tried with location type set as “hash” but that had no effect on the outcome.
Hmmm… could you be a little more specific about the exact commands you’ve been running for building/serving/etc, as well as what “none of the routes load” means? Like the Ember app doesn’t boot at all? Or just that the non-index routes don’t work?