# Custom \`locationType\` Causes \`cannot GET /foo\` with \`ember serve\`

**URL:** <https://discuss.emberjs.com/t/custom-locationtype-causes-cannot-get-foo-with-ember-serve/13054>\
**Category:** Ember CLI\
**Created:** [May 31, 2017, 7:48pm UTC](https://discuss.emberjs.com/t/custom-locationtype-causes-cannot-get-foo-with-ember-serve/13054 "2017-05-31T19:48:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![josiahbryan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/josiahbryan/32/13130_2.png) [@josiahbryan](https://discuss.emberjs.com/u/josiahbryan)\
**Post date:** [May 31, 2017, 7:48pm UTC](https://discuss.emberjs.com/t/custom-locationtype-causes-cannot-get-foo-with-ember-serve/13054/1 "2017-05-31T19:48:44Z")

</div>

**TL;DR: Added custom location type to `environment.js` then `ember serve` → open browser to route /foo → `cannot GET /foo`**

Followed the instructions at [Location - 4.6 - Ember API Documentation](https://www.emberjs.com/api/classes/Ember.Location.html#toc_custom-implementation) and copied the code exactly as it appeared into a file called `app/locations/history-url-logging.js`, added a line to `config/environment.js` that said:

```
ENV.locationType = 'history-url-logging';

```

For reference, the code given in the docs is simply:

```
import Ember from 'ember';

export default Ember.HistoryLocation.extend({
	implementation: 'history-url-logging',

	pushState: function (path) {
		console.log(path);
		this._super.apply(this, arguments);
	}
});

```

I decided to restart the server, did the usual `CTRL+C` to `ember s` then did `ember s` again. I went back to my browser sitting on one of the routes, hit `F5`, and received the cryptic error:

**`Cannot GET /contacts`**

So, after MUCH Googling and trial and error, I discovered that to FIX that error, all I had to do remove the config line ` ENV.locationType = 'history-url-logging';`, restart the server (`ember s`), and suddenly the app worked fine!

What’s even more odd is that if I _start_ the app without that line in `environment.js`, then once the app is running (and the browser window reloads just fine, etc), then I _re-add_ the line that says ` ENV.locationType = 'history-url-logging';` (which triggers a live reload), and the app _still_ works fine! (E.g. hitting F5 to reload the page doesn’t vie me the “Cannot GET /contacts” (or whatever the route is) error.) And, of course, the console gives me the “console.log” output as expected from the code above.

So, long and short of it, using a custom location totally seems to screw up `ember serve` - which is really sad and frustrating! Any ideas how to fix this?

_[Full disclosure: Posted on [SO #44223927](https://stackoverflow.com/questions/44223927/ember-serve-and-browser-reload-results-in-cannot-get-foo-with-custom-ember-lo) with no resolution]_

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [June 6, 2017, 6:07am UTC](https://discuss.emberjs.com/t/custom-locationtype-causes-cannot-get-foo-with-ember-serve/13054/2 "2017-06-06T06:07:20Z")

</div>

> [@josiahbryan](#):
>
> this.\_super.apply(this, arguments);

I would think this is correct. But perhaps it works with `this._super(...arguments);` like here?

[https://github.com/emberjs/api/blob/6b6e331dcc28aa831bcf984d429e59ca6992f278/app/locations/history.js](https://github.com/emberjs/api/blob/6b6e331dcc28aa831bcf984d429e59ca6992f278/app/locations/history.js)

---

<div class="post-metadata">

**Author:** ![josiahbryan](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/josiahbryan/32/13130_2.png) [@josiahbryan](https://discuss.emberjs.com/u/josiahbryan)\
**Post date:** [June 6, 2017, 6:20am UTC](https://discuss.emberjs.com/t/custom-locationtype-causes-cannot-get-foo-with-ember-serve/13054/3 "2017-06-06T06:20:07Z")

</div>

I would think the two syntaxes are identical, besides, that code was copied straight from the documentation. Are you saying you get no errors with Ember serve running that custom location?

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [June 7, 2017, 5:10am UTC](https://discuss.emberjs.com/t/custom-locationtype-causes-cannot-get-foo-with-ember-serve/13054/4 "2017-06-07T05:10:56Z")

</div>

I have not tested yet but I think that if you overwrite `locationType` with your type you lose the `auto` type even if you call \_super.

---

<div class="post-metadata">

**Author:** ![broerse](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/broerse/32/9497_2.png) [@broerse](https://discuss.emberjs.com/u/broerse)\
**Post date:** [June 7, 2017, 6:23pm UTC](https://discuss.emberjs.com/t/custom-locationtype-causes-cannot-get-foo-with-ember-serve/13054/5 "2017-06-07T18:23:00Z")

</div>

If you rename your file to `app\locations\history.js` it works when you leave `locationType` on auto. So it seems that if you write your own you have to include all methods because it states `Each location implementation must provide the following methods` here [Location - 4.6 - Ember API Documentation](https://www.emberjs.com/api/classes/Ember.Location.html#toc_location-api)
