# 502 Bad Gateway

**URL:** <https://discourse.equality-tech.com/t/502-bad-gateway/133>\
**Category:** support\
**Tags:** aws, error, firewall\
**Created:** [December 13, 2017, 10:32pm UTC](https://discourse.equality-tech.com/t/502-bad-gateway/133 "2017-12-13T22:32:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eqt](https://discourse.equality-tech.com/user_avatar/discourse.equality-tech.com/eqt/32/16_2.png) [@eqt](https://discourse.equality-tech.com/u/eqt)\
**Post date:** [December 13, 2017, 10:32pm UTC](https://discourse.equality-tech.com/t/502-bad-gateway/133/1 "2017-12-13T22:32:03Z")

</div>

I visit my wiki, and I get the error message **502 Bad Gateway**

What does this mean? Why is my wiki down?

---

<div class="post-metadata">

**Author:** ![eqt](https://discourse.equality-tech.com/user_avatar/discourse.equality-tech.com/eqt/32/16_2.png) [@eqt](https://discourse.equality-tech.com/u/eqt)\
**Post date:** [December 13, 2017, 11:04pm UTC](https://discourse.equality-tech.com/t/502-bad-gateway/133/2 "2017-12-13T23:04:32Z")

</div>

This error will occur only on AWS, in combination with an external load balancer (ELB) in front of your wiki.

The external load balancer constantly checks the wiki for a “heartbeat”. During a deployment, the platform firewall will prevent the external load balancer (and your users) from reaching the wiki. Since the ELB can’t hear the heartbeat, it thinks the backend is dead and doesn’t know what to do with requests. Your web browser calls it a Bad Gateway. This condition will cure itself once the deploy is finished, since the platform turns off it’s internal firewall _at the end of the deploy_.

As a work-around, you could create a more elaborate deploy where you’re able to provide some backends to the ELB while updating others.

**Fixing this**  
AWS does not allow you to assign an IP address to the ELB. Since Meza works by identifying hosts by IP, it can’t add rules to it’s firewall to allow the ELB in. The best way to avoid this is to not use an ELB at AWS. Meza already supplies both HAProxy for a proxy front-end (aka load balancer) as well as **firewalld** for a firewall. These are both industry-leading infrastructure components, so there isn’t much benefit, if any, in using something else.

There is [a task](https://github.com/enterprisemediawiki/meza/issues/898) for making the internal firewall optional. If this task is implemented, then it would solve the problem as well.
