Skip to content

Commit

Permalink
[core] Proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
devlikepro committed May 18, 2024
1 parent e0a1be1 commit 8be13fb
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions docs/site/content/en/docs/how-to/proxy/index.md
Original file line number Diff line number Diff line change
@@ -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.

<div class="text-center">

![WhatsApp - could not login](could-not-login.png)

</div>

## 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 <b><a href="https://proxy6.net/en/?r=628046" target="_blank">Proxy6</a></b>
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
```

4 changes: 2 additions & 2 deletions docs/site/content/en/docs/how-to/sessions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`.
Expand Down

0 comments on commit 8be13fb

Please sign in to comment.