# Changing \`platform.host\` in \`aurelia.json\` doesn't change the host IP

**URL:** <https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043>\
**Category:** Help Requests\
**Created:** [November 3, 2019, 10:38pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043 "2019-11-03T22:38:31Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonyerskine](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/tonyerskine/32/1647_2.png) [@tonyerskine](https://discourse.aurelia.io/u/tonyerskine)\
**Post date:** [November 3, 2019, 10:38pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/1 "2019-11-03T22:38:31Z")

</div>

Running `au run` in a brand new, default app in a docker container doesn’t expose the app over mapped ports because the app is listening on `localhost` rather than `0.0.0.0`, but changing the `platform.host` setting in `aurelia.json` doesn’t seem to have any effect.

To get the app to listen on `0.0.0.0`, I had to change `webpack.config.js`.

Is there a better way to do this?

See also [this stackoverflow question](https://stackoverflow.com/q/58685078/715608):

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [November 4, 2019, 1:01am UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/2 "2019-11-04T01:01:28Z")

</div>

cc @shahabganji

Before you replace `host` with `0.0.0.0`, can you log the value of `host`? Some docker script might have passed a value to `--host` which overshadows `project.platform.host` in expression `host || project.platform.host`.

---

<div class="post-metadata">

**Author:** ![HamedFathi](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/hamedfathi/32/2099_2.png) [@HamedFathi](https://discourse.aurelia.io/u/HamedFathi)\
**Post date:** [November 4, 2019, 5:25am UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/3 "2019-11-04T05:25:29Z")

</div>

@huochunpeng

Sorry, `Saeed` is busy for a few days. He will reply ASAP.

---

<div class="post-metadata">

**Author:** ![shahabganji](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/shahabganji/32/1539_2.png) [@shahabganji](https://discourse.aurelia.io/u/shahabganji)\
**Post date:** [November 4, 2019, 11:37am UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/4 "2019-11-04T11:37:49Z")

</div>

You’ve added the Dockerfile manually, or you have gone through the “Custom Aurelia App” setup of the cli? If it’s the latter can you share which configurations you’ve chosen? Or tell me the steps to reproduce the problem?

---

<div class="post-metadata">

**Author:** ![mroeling](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/mroeling/32/781_2.png) [@mroeling](https://discourse.aurelia.io/u/mroeling)\
**Post date:** [November 4, 2019, 12:18pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/5 "2019-11-04T12:18:02Z")

</div>

FYI, the stackoverflow issue has recieved a reply: [https://stackoverflow.com/a/58685079/664217](https://stackoverflow.com/a/58685079/664217)  
They have changed the value in webpack.config.js rather than in aurelia.json.

---

<div class="post-metadata">

**Author:** ![shahabganji](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/shahabganji/32/1539_2.png) [@shahabganji](https://discourse.aurelia.io/u/shahabganji)\
**Post date:** [November 4, 2019, 12:30pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/6 "2019-11-04T12:30:05Z")

</div>

This is not anything with Aurelia, it is webpack that needs to change the host. I’ve answered on the stack question, just pass the —host 0.0.0.0 to the au run command.

---

<div class="post-metadata">

**Author:** ![shahabganji](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/shahabganji/32/1539_2.png) [@shahabganji](https://discourse.aurelia.io/u/shahabganji)\
**Post date:** [November 4, 2019, 12:30pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/7 "2019-11-04T12:30:43Z")

</div>

And there is no need to change anything, since you can override it with flags.

---

<div class="post-metadata">

**Author:** ![tonyerskine](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/tonyerskine/32/1647_2.png) [@tonyerskine](https://discourse.aurelia.io/u/tonyerskine)\
**Post date:** [November 4, 2019, 5:42pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/8 "2019-11-04T17:42:49Z")

</div>

`au run --host 0.0.0.0` did fix the problem without changing the `webpack.config.js`, which is good.

My question is, shouldn’t changing `aurelia.json` change the default setting, so I don’t have to use a command line argument? If not, is there a good way to change the default setting and what’s the purpose of `aurelia.json`?

Someone asked about my docker file and how I created the app. Here’s my Dockerfile:

```
FROM node

RUN npm install -g aurelia-cli

WORKDIR /app

EXPOSE 8080

CMD /bin/bash

```

And I created the app, with `au new` and selected all the defaults, i.e. `npm` and `ESNext`. I think that should be enough to let you recreate it.

Thanks for all the help.

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [November 4, 2019, 9:50pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/9 "2019-11-04T21:50:32Z")

</div>

OK, I got something wrong. Nothing to do with docker. Here is the log of `host` without explicit `--host`. Note the logged webpack command: `webpack-dev-server --extractCss`

```auto
⋊> ~/p/w au run
Local aurelia-cli v1.2.1
Starting 'run'...
`au run` is an alias of the `npm start`, you may use either of those; see README for more details.

> w@0.1.0 start /Users/huocp/playground/w
> webpack-dev-server --extractCss

host: localhost
project.platform.host: 127.0.0.1
ℹ ｢wds｣: Project is running at http://localhost:8080/

```

Somehow, the webpack config got `localhost` as the value of `host`, that means `project.platform.host` is never honoured in `host || project.platform.host`.

I need to find out why webpack config does that.

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [November 4, 2019, 10:16pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/10 "2019-11-04T22:16:51Z")

</div>

webpack-dev-server fills up some default value to webpack config. It adds `host` with value `localhost` when user didn’t explicitly set in command line.

> <https://github.com/webpack/webpack-dev-server/blob/4d99f6d917c1db0f180490be86f794ba8e93089f/bin/options.js#L173-L175>

> <https://github.com/webpack/webpack-dev-server/blob/4d99f6d917c1db0f180490be86f794ba8e93089f/bin/webpack-dev-server.js#L70>

This is annoying, our `host || project.platform.host` never worked.

The funny thing is webpack-dev-server only mutates the options passed to webpack config. Whether the user uses that passed in `host` value inside `devServer` config, it’s totally up to the user. This is beyond my comprehension of design.

---

<div class="post-metadata">

**Author:** ![huochunpeng](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@huochunpeng](https://discourse.aurelia.io/u/huochunpeng)\
**Post date:** [November 4, 2019, 10:19pm UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/11 "2019-11-04T22:19:18Z")

</div>

BTW, webpack-dev-server didn’t add default value to `port` option, so our `port: port || project.platform.port,` still works.

Update: Latest aurelia-cli release v1.2.2 bypassed this webpack-dev-server issue.

Fixed here: [https://github.com/aurelia/cli/pull/1155/files](https://github.com/aurelia/cli/pull/1155/files)

---

<div class="post-metadata">

**Author:** ![shahabganji](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/shahabganji/32/1539_2.png) [@shahabganji](https://discourse.aurelia.io/u/shahabganji)\
**Post date:** [November 5, 2019, 6:33am UTC](https://discourse.aurelia.io/t/changing-platform-host-in-aurelia-json-doesnt-change-the-host-ip/3043/12 "2019-11-05T06:33:30Z")

</div>

It looks that @huochunpeng resolved the issue; about the Dockerfile, I see no problem in that, except that it is kind of development-like Dockerfile, for more information regarding this matter please check out [here](https://aurelia.io/docs/build-systems/docker/setup) and [here](https://medium.com/@shahabganji/dockerize-your-aurelia-application-9db72e70e4a2?source=your_stories_page---------------------------)
