WhatsApp-Business-API-Setup-Scripts
WhatsApp-Business-API-Setup-Scripts copied to clipboard
Deploy behind reverse proxy
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 can you elaborate more on how you set up these different instances?
- 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
- is each instance running with a different phone number?
@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