> For the complete documentation index, see [llms.txt](https://docs.imsel.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imsel.dev/tekhnicheskaya-dokumentaciya/domain-fronting.md).

# Подписка через домен-фронтинг

Домен-фронтинг (Domain Fronting) позволяет обращаться к серверу подписки через «фронт» — крупный CDN/облачный домен, который не блокируется. Соединение устанавливается с IP-адресом фронта, но HTTP-запрос идёт с Host-заголовком настоящего сервера. Провайдер видит подключение к «белому» домену, а не к домену VPN-панели.

## Формат ссылки

Фронтинг-параметры передаются в фрагменте ссылки подписки (после `#имя?`):

```
https://<front-domain>/<path>/<token>#<name>?resolve-address=<front-domain>&host=<real-host>
```

| Часть             | Значение                                                                           | Пример                   |
| ----------------- | ---------------------------------------------------------------------------------- | ------------------------ |
| `<front-domain>`  | Домен-фронт в самой ссылке (authority) — виден провайдеру как цель подключения     | `gmail.com`              |
| `resolve-address` | Домен, который клиент резолвит и подключается по IP напрямую (обычно тот же фронт) | `gmail.com`              |
| `host`            | Настоящий Host-заголовок — домен, на который CDN маршрутизирует запрос             | `storage.googleapis.com` |

`resolve-address` и `host` можно комбинировать с любым `front-domain`: адрес подключения определяется фронт-доменом (`resolve-address`), а маршрутизация на сервер — заголовком `host`.

## Пример: три зеркала

Первый URL без метки, последующие — с метками `url:N=`, в конце `fallback-url=`:

```
https://gmail.com/runrun1/token#rahima?resolve-address=gmail.com&host=storage.googleapis.com|url:1=https://www.google.com/runrun1/token#rahima?resolve-address=www.google.com&host=storage.googleapis.com|url:2=https://fcm.googleapis.com/runrun1/token#rahima?resolve-address=fcm.googleapis.com&host=storage.googleapis.com|fallback-url=https://backup.example.com/token
```

Клиент пробует зеркала по порядку: `gmail.com` → `www.google.com` → `fcm.googleapis.com`. Каждый резолвится отдельно, соединение идёт на IP соответствующего фронта, Host-заголовок всегда `storage.googleapis.com`. Если все три недоступны — используется `fallback-url`. Тот же список без меток (просто через `|`) тоже работает.

## Управление фронтинг-зеркалами из подписки

Команды управления ([app-management.md](/tekhnicheskaya-dokumentaciya/app-management.md)) работают с фронтинг-зеркалами через помеченные позиции: первый URL — позиция `0`, `url:1` — второй, `url:N` — позиция `N`:

```http
new-url: https://drive.google.com/runrun1/token#rahima?resolve-address=drive.google.com&host=storage.googleapis.com
new-url-1: https://www.google.com/runrun1/token#rahima?resolve-address=www.google.com&host=storage.googleapis.com
new-url-1: resolve-address=142.251.41.165
new-url-1: host=storage.googleapis.com
new-domain: drive.google.com
new-url-2: 0
fallback-url: https://fcm.googleapis.com/runrun1/token#rahima?resolve-address=fcm.googleapis.com&host=storage.googleapis.com
```

* `new-url` — заменить **только первый URL** (позиция 0);
* `new-url-N: <url>` — заменить зеркало на позиции N целиком (обычный или фронтинг-URL); N = количество — добавить в конец; `0` — удалить;
* `new-url-N: resolve-address=<домен|IP>` — точечно заменить только `resolve-address` (IP-адрес разрешён: фронт резолвится заранее и подключение идёт на указанный IP);
* `new-url-N: host=<домен>` — точечно заменить только `host` (Host-заголовок фронтинга);
* `new-domain` / `new-domain-N` — заменить фронт-домен: меняется host ссылки и `resolve-address` (если совпадал со старим фронтом); `host=` не трогается — CDN-маршрутизация сохраняется;
* `fallback-url` — запасной фронтинг-URL на случай, когда все зеркала недоступны.

## Ограничения

* Резолв `resolve-address` выполняется системным DNS: если домен фронта резолвится на «заглушку», соединение не состоится — выбирайте живые фронты.
* Фронт должен поддерживать маршрутизацию по Host-заголовку на ваш сервер (типично для Google/Cloudflare/AWS-инфраструктур); иначе CDN вернёт ошибку.
* HTTP/2-мультиплексирование на некоторых CDN игнорирует Host-заголовок после установления соединения — при странном поведении попробуйте другой фронт.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.imsel.dev/tekhnicheskaya-dokumentaciya/domain-fronting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
