# Multicontainer Public URL Socket Hang Up

**URL:** <https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594>\
**Category:** Product support\
**Created:** [April 16, 2020, 5:41pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594 "2020-04-16T17:41:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![timelapsepaul](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@timelapsepaul](https://forums.balena.io/u/timelapsepaul)\
**Post date:** [April 16, 2020, 5:41pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594/1 "2020-04-16T17:41:01Z")

</div>

Hi, I’m trying to expose a web server in a container. I can see from logs that the server (express) is successfully listening on port 80, but when I try to access it via the Public URL from the dashboard, I keep getting the ‘Error accessing device’ page with reason ‘socket hang up’.

I have tried the following in the docker-compose.yml but all have the same result

```auto
services:
  server:
    build: ./server
    expose:
      - "80"
    network_mode: host

```

```auto
services:
  server:
    build: ./server
    ports:
      - "80:80"
    network_mode: host

```

```auto
services:
  server:
    build: ./server
    ports:
      - "80:80"
    expose:
      - "80"
    network_mode: host

```

plus the above without network\_mode, and with only network\_mode: host without expose or ports set.

What needs to be in docker-compose.yml to be able to successfully reach the server?

---

<div class="post-metadata">

**Author:** ![ab77](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ab77/32/2870_2.png) [@ab77](https://forums.balena.io/u/ab77)\
**Post date:** [April 16, 2020, 5:50pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594/2 "2020-04-16T17:50:05Z")

</div>

Hi there, what output do you get when you console to your container and host and execute:

```auto
curl localhost -v

```

---

<div class="post-metadata">

**Author:** ![timelapsepaul](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@timelapsepaul](https://forums.balena.io/u/timelapsepaul)\
**Post date:** [April 16, 2020, 5:57pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594/3 "2020-04-16T17:57:16Z")

</div>

Host:

```auto
curl localhost -v
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 80 (#0)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.64.1
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
* Closing connection 0

```

Container:

```auto
curl localhost -v
* Expire in 0 ms for 6 (transfer 0x2248728)
* Expire in 1 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 2 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 2 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 2 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 2 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 2 ms for 1 (transfer 0x2248728)
* Expire in 0 ms for 1 (transfer 0x2248728)
* Expire in 1 ms for 1 (transfer 0x2248728)
* Expire in 2 ms for 1 (transfer 0x2248728)
* Expire in 1 ms for 1 (transfer 0x2248728)
* Expire in 1 ms for 1 (transfer 0x2248728)
* Expire in 4 ms for 1 (transfer 0x2248728)
* Expire in 1 ms for 1 (transfer 0x2248728)
* Expire in 1 ms for 1 (transfer 0x2248728)
* Expire in 2 ms for 1 (transfer 0x2248728)
* Trying ::1...
* TCP_NODELAY set
* Expire in 149997 ms for 3 (transfer 0x2248728)
* Expire in 200 ms for 4 (transfer 0x2248728)
* Connected to localhost (::1) port 80 (#0)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.64.0
> Accept: */*
> 
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

```

---

<div class="post-metadata">

**Author:** ![ab77](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ab77/32/2870_2.png) [@ab77](https://forums.balena.io/u/ab77)\
**Post date:** [April 16, 2020, 5:58pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594/4 "2020-04-16T17:58:35Z")

</div>

Looks like your application isn’t returning a valid HTTP response on port 80, which is why you are seeing the message from the public URL proxy.

---

<div class="post-metadata">

**Author:** ![timelapsepaul](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@timelapsepaul](https://forums.balena.io/u/timelapsepaul)\
**Post date:** [April 16, 2020, 6:02pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594/5 "2020-04-16T18:02:40Z")

</div>

My bad, I was creating a https server. 🙄

---

<div class="post-metadata">

**Author:** ![ab77](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ab77/32/2870_2.png) [@ab77](https://forums.balena.io/u/ab77)\
**Post date:** [April 16, 2020, 6:04pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594/6 "2020-04-16T18:04:04Z")

</div>

No worries. Hopefully changing your app to listen on HTTP/80 will solve this issue.

---

<div class="post-metadata">

**Author:** ![timelapsepaul](https://avatars.discourse-cdn.com/v4/letter/t/9fc348/32.png) [@timelapsepaul](https://forums.balena.io/u/timelapsepaul)\
**Post date:** [April 16, 2020, 6:06pm UTC](https://forums.balena.io/t/multicontainer-public-url-socket-hang-up/94594/7 "2020-04-16T18:06:42Z")

</div>

I was using https.createServer in node instead of http.createServer  
All good now.
