diff --git a/docs/site/content/en/docs/how-to/proxy/could-not-login.png b/docs/site/content/en/docs/how-to/proxy/could-not-login.png new file mode 100644 index 00000000..94ac835e Binary files /dev/null and b/docs/site/content/en/docs/how-to/proxy/could-not-login.png differ diff --git a/docs/site/content/en/docs/how-to/proxy/index.md b/docs/site/content/en/docs/how-to/proxy/index.md new file mode 100644 index 00000000..f5880c52 --- /dev/null +++ b/docs/site/content/en/docs/how-to/proxy/index.md @@ -0,0 +1,95 @@ +--- +title: "🌐 Proxy" +description: "Proxy" +lead: "" +date: 2020-10-06T08:48:45+00:00 +lastmod: 2020-10-06T08:48:45+00:00 +draft: false +images: [ ] +weight: 126 +--- + +## 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]({{< relref "/docs/how-to/engines" >}}). + +### Symptoms +1. You start a new session in WhatsApp. +2. Scan the QR code. +3. Experience a long loading time. +4. Face login failures or instant logout. +5. Encounter a new QR code or enter a FAILED state immediately. + +
+ + ![WhatsApp - could not login](could-not-login.png) + +
+ +## Configuration +There are two ways to set up proxies: +1. Global Setting (for all sessions per container) +2. 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 format `host:port`, without HTTP or HTTPS. +- `WHATSAPP_PROXY_SERVER_USERNAME=username` and `WHATSAPP_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** ->]({{< relref "/docs/how-to/config#proxy" >}}). + +### Session Proxy Configuration +You can configure proxy for a session by setting `config.proxy` fields when you `POST /api/sessions/start`: +- `server` - proxy server address, without `http://` or `https://` prefixes +- `username` and `password` - set this if the proxy requires authentication + + +**No authentication** +```json +{ + "name": "default", + "config": { + "proxy": { + "server": "localhost:3128" + } + } +} +``` + +**Proxy with authentication** +```json +{ + "name": "default", + "config": { + "proxy": { + "server": "localhost:3128", + "username": "username", + "password": "P@ssw0rd" + } + } +} +``` + +The configuration is saved and will be applied if the docker container restarts, +and you set `WHATSAPP_RESTART_ALL_SESSIONS` environment variables. +Read more about it in [Autostart section](#autostart). + +Read more about it on [**Sessions page** ->]({{< relref "/docs/how-to/sessions#configure-proxy" >}}). + + +## Recommended Proxies + +### Proxy6 +We recommend using 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 +``` + diff --git a/docs/site/content/en/docs/how-to/sessions/index.md b/docs/site/content/en/docs/how-to/sessions/index.md index 649ff4e4..65c374b6 100644 --- a/docs/site/content/en/docs/how-to/sessions/index.md +++ b/docs/site/content/en/docs/how-to/sessions/index.md @@ -46,7 +46,7 @@ and you set `WHATSAPP_RESTART_ALL_SESSIONS` environment variables. Read more about it in [Autostart section](#autostart). #### Configure proxy -You can configure proxy for a session by setting `config.proxy` fields: +You can configure proxy for a session by setting `config.proxy` fields when you `POST /api/sessions/start`: - `server` - proxy server address, without `http://` or `https://` prefixes - `username` and `password` - set this if the proxy requires authentication @@ -82,7 +82,7 @@ and you set `WHATSAPP_RESTART_ALL_SESSIONS` environment variables. Read more about it in [Autostart section](#autostart). You can configure proxy when for all sessions by set up environment variables. -Read more about it on [**Configuration page** ->]({{< relref "/docs/how-to/config#proxy" >}}). +Read more about it on [**Proxy page** ->]({{< relref "/docs/how-to/proxy" >}}) or [**Configuration page** ->]({{< relref "/docs/how-to/config#proxy" >}}). #### Enable debug You can enable debug mode for a session by setting `config.debug` field to `true`.