# 502 Bad Gateway Error

**URL:** <https://openvidu.discourse.group/t/502-bad-gateway-error/3398>\
**Category:** Issues with deployment\
**Tags:** v2\
**Created:** [September 21, 2021, 7:21pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398 "2021-09-21T19:21:40Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 21, 2021, 7:21pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/1 "2021-09-21T19:21:40Z")

</div>

I have used the openvidu-call angular app as a base to build a customized app for our company. I am not trying to deploy it to the Openvidu server we have in AWS. I have updated my /opt/openvidu/docker-compose.override.yml file with my image (which was generated using the following command: “docker build -f docker/custom.dockerfile -t bridgeinsure/kottervidu --network host --build-arg BASE\_HREF=/ .”

After which i run sudo ./openvidu restart which results in no errors.

However when i browse to the app it gives me the nginx 502 bad gateway error. I suspect the issue is the http vs https issue mentioned "It’s very important expose your application in port 5442 and use the http protocol”? Since my app automatically goes to https when I browse … [http://vid.keithgallant.com](http://vid.keithgallant.com)

Can someone please help explain how i can make this happen?

NOTE: I did post this question as a followup to another topic in the “Issues Developing apps” category … i apologize for the repitition but i am under the gun to get a live demo deployed. Everything works perfectly when running locally.

Thank you.

Keith Gallant

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [September 21, 2021, 9:05pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/2 "2021-09-21T21:05:23Z")

</div>

A 502 means that the nginx container is not able to reach your OpenVidu Call App. Is your app running over http in port 5442? What the port 5442 means is that your app should be exposed in OpenVIdu at port 5442 so the nginx container can reach it through [http://localhost:5442](http://localhost:5442)

Did you try to do a curl request to the app? Something like:

```auto
curl localhost:5442

```

If the App is based in OpenVidu Call, it should return an html. If that does not return something, your app is not running at 5442.

---

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 21, 2021, 9:51pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/3 "2021-09-21T21:51:13Z")

</div>

cruizba

Thank you for your reply. the curl request does fail ( Failed to connect to localhost port 5442: Connection refused) … how do i make that happen? Is that a config change needed inside the angular app? Or within the build command or docker?

Keith

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [September 21, 2021, 9:58pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/4 "2021-09-21T21:58:11Z")

</div>

After the build, did you configured the image in the docker-compose.override.yml?

```auto
version: '3.1'

services:
    # --------------------------------------------------------------
    #
    # Change this if your want use your own application.
    # It's very important expose your application in port 5442
    # and use the http protocol.
    #
    # Default Application
    #
    # Openvidu-Call Version: 2.19.0
    #
    # --------------------------------------------------------------
    app:
        image: bridgeinsure/kottervidu <--------- THIS
        restart: on-failure
        network_mode: host
        environment:
            - SERVER_PORT=5442
            - OPENVIDU_URL=http://localhost:5443
            - OPENVIDU_SECRET=${OPENVIDU_SECRET}
            - CALL_OPENVIDU_CERTTYPE=${CERTIFICATE_TYPE}
        logging:
            options:
                max-size: "${DOCKER_LOGS_MAX_SIZE:-100M}"

```

After that, execute `./openvidu restart`

---

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 21, 2021, 10:42pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/5 "2021-09-21T22:42:51Z")

</div>

Yes I did do that. And there are no errors showing after that restart.

---

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 21, 2021, 11:02pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/6 "2021-09-21T23:02:13Z")

</div>

It is using my image as can be seen in the following excerpt from the restart logs:

ubuntu@ip-172-31-29-87:/opt/openvidu$ sudo ./openvidu restart  
Removing network openvidu\_default  
Creating network “openvidu\_default” with the default driver  
Pulling app (bridgeinsure/kottervidu:)…  
latest: Pulling from bridgeinsure/kottervidu  
bbf911997326: Pull complete  
fa649ee9f5fb: Pull complete  
7928b9611049: Pull complete  
351dce8941cd: Pull complete  
e5655c8c8f78: Pull complete  
0dda11d564f5: Pull complete  
2e352c6c52ce: Pull complete  
61b5829fd91c: Pull complete  
Digest: sha256:a85826ee3474e16835002a5b5b7590c266721499f62f7991d669a0be3a824eb3  
Status: Downloaded newer image for bridgeinsure/kottervidu:latest  
Creating openvidu\_coturn\_1 … done  
Creating openvidu\_redis\_1 … done  
Creating openvidu\_nginx\_1 … done  
Creating openvidu\_kibana\_1 … done  
Creating openvidu\_app\_1 … done  
Creating openvidu\_openvidu-server\_1 … done  
Creating openvidu\_metricbeat\_1 … done  
Creating openvidu\_elasticsearch\_1 … done  
Creating openvidu\_filebeat\_1 … done  
Attaching to openvidu\_openvidu-server\_1

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [September 22, 2021, 8:46am UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/7 "2021-09-22T08:46:53Z")

</div>

What logs do you have in `openvidu_app_1` container?

---

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 22, 2021, 3:13pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/8 "2021-09-22T15:13:57Z")

</div>

cruizba

I am not sure what you mean? How do I view those?

Keith

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [September 22, 2021, 3:34pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/9 "2021-09-22T15:34:42Z")

</div>

In `/opt/openvidu` execute:

```auto
sudo su
docker-compose logs app 

```

or

```auto
sudo su
docker logs openvidu_app_1

```

---

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 22, 2021, 4:29pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/10 "2021-09-22T16:29:12Z")

</div>

> [@cruizba](#):
>
> `docker logs openvidu_app_1`

There is obviously a problem … this shows:

standard\_init\_linux.go:228: exec user process caused: exec format error

---

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 22, 2021, 4:45pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/11 "2021-09-22T16:45:24Z")

</div>

When I look at the entrypoint.sh file in my app it has the following:

cd /opt/openvidu-call  
nodemon openvidu-call-server.js

however this doesnt exist on my AWS server? Is this something generated inside the docker? And should the folder be my new image name? ie kottervidu

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [September 22, 2021, 5:17pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/12 "2021-09-22T17:17:41Z")

</div>

Did you modified something of the Dockerfile `custom.dockerfile` or the `entrypoint.sh`?

You can forget about the docker image if you want. Instead of building the Docker container, just clone your project into the server and run it at port 5442 with http.

So if you’re able to run your app at port 5442, you can do that in the server.

---

<div class="post-metadata">

**Author:** ![keithg](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@keithg](https://openvidu.discourse.group/u/keithg)\
**Post date:** [September 22, 2021, 6:08pm UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/13 "2021-09-22T18:08:11Z")

</div>

I ddnt edit the custom.dockerfile or entrypoint.sh file no …

To “run it at port 5442 with http” do you mean run the docker run command from within the AWS server? If doing this … i will have to go to [http://vid.keithgallant.com:5442](http://vid.keithgallant.com:5442) in order to use the app though right?

---

<div class="post-metadata">

**Author:** ![cruizba](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/cruizba/32/18_2.png) [@cruizba](https://openvidu.discourse.group/u/cruizba)\
**Post date:** [September 23, 2021, 8:15am UTC](https://openvidu.discourse.group/t/502-bad-gateway-error/3398/14 "2021-09-23T08:15:55Z")

</div>

- No, I was talking about running the node server directly in the machine using port 5442.
- No, you don’t need to access through 5442. Anything running at port 5442 will be redirected to 443 by the nginx proxy
