Cordova with enabled Ember-CLI proxy suffers from hash based routing
Opened this issue · 4 comments
I'm using Ember CLI 0.2.3
with ember-cli-cordova 0.0.16
. The Ember app is connected to a Rails API. Thus, I use ember server --proxy http://localhost:3000
. If I set EMBER_CLI_CORDOVA=1
, this changes the URLs of my app: The top route of my app is now http://localhost:4200/#/
instead of http://localhost:4200/
. Under http://localhost:4200/
I now get the top route's template of the Rails app, which is equivalent to http://localhost:3000/
.
So, ember-cli-cordova is changing routes. IMHO, it shouldn't do that. Is this intended?
Update:
This seems to be an effect of the ember-cli proxy (see ember-cli/ember-cli#3398). Apparently, only sub paths are properly proxied (ember-cli/ember-cli#3398 (comment)). If /
is proxied, you will need a hash based routing to access it: /#/
.
Ember-cli-cordova doesn't work correctly with proxy. Not only will the routes change, but now it tries to GET /cordova.js
from the proxy instead of the ember host (which would be GET /#/cordova.js
).
Hi @AW-UC
Try to set defaultLocationType on your config to auto (e. g https://github.com/uhuraapp/uhura-dashboard/blob/master/config/environment.js#L8) and remove locationType config
@dukex thanks, but I already had those settings. If they are not set, ember-cli-cordova even prints an error message.
@dukex Please see the updates to my post. The problem is, that defaultLocationType
is overriden by the proxy. Thus, ember-cli-cordova does not work correctly with the proxy feature for now.
I am experiencing the same, any updates on this?