WhatsApp-Business-API-Setup-Scripts icon indicating copy to clipboard operation
WhatsApp-Business-API-Setup-Scripts copied to clipboard

Deploy behind reverse proxy

Open marcocaberletti opened this issue 4 years ago • 2 comments

Hi! I should deploy many different WhatsApp API instances behind a reverse proxy, using different paths to route the traffic. Every instance is a different host with a docker-compose stack.

So, for example:

my.domain.example/client-1 ---> instance-1
my.domain.example/client-2 ---> instance-2

I try to do this setup, but I get this error:

app.ERROR: [b278a05bed9347d9b0295ebaf9da6e75] Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /client-1" (uncaught exception) at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php line 2 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /client-1\" at /var/www/html/vendor/symfony/http-kernel/EventListener/RouterListener.php:2, Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/client-1\". at /var/www/html/vendor/symfony/routing/Matcher/UrlMatcher.php:2)"} []

Can you help me?

marcocaberletti avatar Jul 31 '20 10:07 marcocaberletti

@marcocaberletti can you elaborate more on how you set up these different instances?

  1. are they using the same db host? if so, you need to set the WA_DB_HOSTNAME env var according to https://developers.facebook.com/docs/whatsapp/guides/mysql
  2. is each instance running with a different phone number?

mengyiyuan avatar Aug 03 '20 09:08 mengyiyuan

@mengyiyuan in my setup, every instance is independent. Every instance is a EC2 instance with its own DB and run with different phone number. Currently, I create a new DNS name for every instance:

client-1.domain.example --> instance-1
client-2.domain.example --> instance-2

My goal is to use a single DNS name and use a different path to "select" the client:

wa.domain.example/client-1 --> instance-1
wa.domain.example/client-2 --> instance-2

marcocaberletti avatar Aug 04 '20 10:08 marcocaberletti