ember-cli-cordova icon indicating copy to clipboard operation
ember-cli-cordova copied to clipboard

Cordova with enabled Ember-CLI proxy suffers from hash based routing

Open Awem opened this issue 10 years ago • 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 https://github.com/ember-cli/ember-cli/pull/3398). Apparently, only sub paths are properly proxied (https://github.com/ember-cli/ember-cli/pull/3398#issuecomment-76718460). 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).

Awem avatar Apr 13 '15 18:04 Awem

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 avatar Apr 13 '15 18:04 dukex

@dukex thanks, but I already had those settings. If they are not set, ember-cli-cordova even prints an error message.

Awem avatar Apr 13 '15 20:04 Awem

@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.

Awem avatar Apr 15 '15 11:04 Awem

I am experiencing the same, any updates on this?

WillanTheunissen avatar Dec 21 '21 11:12 WillanTheunissen