🌐 Proxy
Overview
If you’re experiencing issues scanning QR codes in WhatsApp, especially with Indian 🇮🇳 phone numbers, using a proxy located close to the phone number’s location may help resolve the problem.
It affects both WEBJS and NOWEB engines.
👉 If proxy doesn’t help but the project works on YOUR local laptop - check Tunneling.
Symptoms
- You start a new session in WhatsApp.
- Scan the QR code.
- Experience a long loading time.
- Face login failures or instant logout.
- Encounter a new QR code or enter a FAILED state immediately.
Solutions
There are two ways to solve this issue:
- Use a proxy (read this page and article about WAHA + Geonode).
- Running WAHA on local network and expose WAHA with Ngrok.
Configuration
There are two ways to set up proxies:
- Global Setting (for all sessions per container)
- Per Session Configuration (you can define a proxy for each session when you start it)
Global Proxy Configuration
To use a proxy, you can set the following environment variables:
WHATSAPP_PROXY_SERVER=localhost:3128
: Set the proxy server in the formathost:port
, without HTTP or HTTPS.WHATSAPP_PROXY_SERVER_USERNAME=username
andWHATSAPP_PROXY_SERVER_PASSWORD=password
: Configure credentials for the proxy.WHATSAPP_PROXY_SERVER_LIST=host1.example.com:3138,host2.example.com:3138
: Specify a comma-separated list of addresses to use, utilizing a round-robin algorithm for server selection.WHATSAPP_PROXY_SERVER_INDEX_PREFIX=proxy-
: Define a session name prefix to choose the appropriate proxy from the list.
Read more about it on Configuration page ->.
Session Proxy Configuration
You can configure proxy for a session by setting config.proxy
fields when you POST /api/sessions/
:
server
- proxy server address, withouthttp://
orhttps://
prefixesusername
andpassword
- set this if the proxy requires authentication
No authentication
{
"name": "default",
"config": {
"proxy": {
"server": "localhost:3128"
}
}
}
Proxy with authentication
{
"name": "default",
"config": {
"proxy": {
"server": "localhost:3128",
"username": "username",
"password": "P@ssw0rd"
}
}
}
Read more about it on Sessions page ->.
Recommended Proxies
Geonode
We recommend using Geonode.
Proxy6
Another option is Proxy6 where you can get a dedicated proxy (only you’ll use it) for $1.77 per month.
Apply the promocode get a 5% discount on your purchase.
9W9oVxx3UX
Tunneling
If you can’t use a proxy (or it doesn’t help), you can try tunneling the connection to your local machine.
You can run WAHA on local network then, you can buy something like RaspberryPi or a small server (lenovo m93 or similar) and host it there.
So the setup would look like:
- You have an app (with your logic and database) running on VPS
- You have WAHA running on your local network on some dedicated PC (mongodb or file MUST be placed on this server as well)
- You have ngrok (or any similar reverse proxy) running on local network and sharing 3000 port on dedicated name (paid ngrok required for that)
- Your App communicated with WAHA API using the external ngrok name and WAHA send webhooks back to the server
There’s nothing we can do about network detection from Meta side :(