# Using a Flask Server with public URL

**URL:** <https://forums.balena.io/t/using-a-flask-server-with-public-url/93328>\
**Category:** Product support\
**Created:** [April 13, 2020, 8:57pm UTC](https://forums.balena.io/t/using-a-flask-server-with-public-url/93328 "2020-04-13T20:57:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GregorR](https://avatars.discourse-cdn.com/v4/letter/g/8797f3/32.png) [@GregorR](https://forums.balena.io/u/GregorR)\
**Post date:** [April 13, 2020, 8:57pm UTC](https://forums.balena.io/t/using-a-flask-server-with-public-url/93328/1 "2020-04-13T20:57:28Z")

</div>

I’m trying to set up a RPi 3 as a web server using the public URL. I’ve set up the device with Balena Wifi Connect, and I’m not sure if this is causing an issue.

My docker-compose.yml file is:

```
version: "2.1"

services:

    wifi-connect:
    build: ./wifi-connect-master
    network_mode: "host"
    labels:
        io.balena.features.dbus: '1'
    cap_add:
        - NET_ADMIN
    environment:
        DBUS_SYSTEM_BUS_ADDRESS: "unix:path=/host/run/dbus/system_bus_socket"
        
Web_Server:
    build: ./Web_Server
    privileged: true
    expose:
      - "80"

```

I’m just getting an error saying:

```
We encountered an error when reaching this [balena.io](https://balena.io/) device:

UUID 3ba5b6d5dc930ca665225936bfd3c62e

`tunneling socket could not be established: 500`

One possible reason is because nothing is listening on port 80 on the device.

```

I’ve granted support access and my UUID is 3ba5b6d5dc930ca665225936bfd3c62e

I got the code from [https://github.com/balenalabs/balena-python-hello-world/blob/master/Dockerfile.template](https://github.com/balenalabs/balena-python-hello-world/blob/master/Dockerfile.template)

---

<div class="post-metadata">

**Author:** ![anujdeshpande](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/anujdeshpande/32/3155_2.png) [@anujdeshpande](https://forums.balena.io/u/anujdeshpande)\
**Post date:** [April 14, 2020, 2:43am UTC](https://forums.balena.io/t/using-a-flask-server-with-public-url/93328/2 "2020-04-14T02:43:59Z")

</div>

Hi  
`expose` exposes ports without publishing them to the host machine - they’ll only be accessible to linked services. What you want to use is the `ports` command

See an example in action here - [https://github.com/balenalabs/multicontainer-getting-started/blob/master/docker-compose.yml](https://github.com/balenalabs/multicontainer-getting-started/blob/master/docker-compose.yml)

---

<div class="post-metadata">

**Author:** ![GregorR](https://avatars.discourse-cdn.com/v4/letter/g/8797f3/32.png) [@GregorR](https://forums.balena.io/u/GregorR)\
**Post date:** [April 14, 2020, 2:20pm UTC](https://forums.balena.io/t/using-a-flask-server-with-public-url/93328/4 "2020-04-14T14:20:02Z")

</div>

That was it, thanks.

I had tried this before but had accidentally put the dockerfile.template for the wifi-connect in the wrong folder so I started with fresh downloads of the two services and it is all working now.

Thanks,  
Gregor

---

<div class="post-metadata">

**Author:** ![tmigone](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/tmigone/32/2814_2.png) [@tmigone](https://forums.balena.io/u/tmigone)\
**Post date:** [April 14, 2020, 2:27pm UTC](https://forums.balena.io/t/using-a-flask-server-with-public-url/93328/5 "2020-04-14T14:27:03Z")

</div>

Glad to know it’s working now Gregor!
