blaineh
blaineh

Reputation: 2323

Ember gives 404 after page refresh 404 apache on localhost

This probably has to do with not using rails or hosting in couchapp, but I'd like to solve this problem without involving another layer of code.

I'm writing an Ember app, and when I refresh the browser on any route except the index (home) route I get a 404. Getting to routes only works when it's done through Ember code, such as {{#linkTo}}s or transitionTos.

Apache version: Server version: Apache/2.2.22 (Ubuntu)

Upvotes: 1

Views: 1023

Answers (1)

Kingpin2k
Kingpin2k

Reputation: 47367

This sounds like an issue with one (or all) of your model hooks. Since everything after the # doesn't get sent back to the server, so any link-to or transition wouldn't make any difference,

server/cow is the same to the server as server/cow#/comments/3/posts.

Aka, you might have been passing models down to each nested resource lower using a link-to, but when it reloads that route, the param in the url is passed to the model hook to resolve the model.

As was pointed out below in the comments, if you aren't using the hash tag (aka using location:history or location:none) you need to use some form of url rewrite at the root of your ember application so your url. Be aware that if you choose one of those options you are limiting the functionality of your application to modern browsers (http://caniuse.com/history).

Upvotes: 1

Related Questions