# Domain for a Telegram Mini App or Bot: HTTPS and Webhook Setup

> What a Telegram Mini App and bot need from a domain: HTTPS, webhook ports, BotFather settings, Cloudflare and the Mini App domain rule of 20 July 2026.

- Language: en
- Published: 2026-11-27 · Updated: 2026-11-27
- HTML: https://rikidomains.at/en/guides/domain-for-telegram-mini-app-and-bot/
- Markdown: https://rikidomains.at/en/guides/domain-for-telegram-mini-app-and-bot/index.md
- RU version: https://rikidomains.at/ru/guides/domen-dlya-telegram-mini-app-i-bota/

A domain is not required for every Telegram bot. It becomes necessary in two cases: when a bot receives updates through a webhook, and when you build a Mini App, a web page that opens inside Telegram. Both need a secure address, and since 20 July 2026 Telegram also ties a Mini App's methods to its original domain, so the domain you choose becomes part of the app's identity. Below is what Telegram's documentation says about domains, how to set one up behind Cloudflare and where the typical errors come from. Data as of 27 November 2026, with links to Telegram's own pages.

## The short answer

- **A bot on long polling needs no domain.** It asks Telegram for updates itself, so there is no incoming connection to secure. A domain appears when you switch to a webhook or build a Mini App.
- **Webhook:** HTTPS only, on port 443, 80, 88 or 8443, TLS 1.2 or newer. IPv6 is not supported for webhooks, so the host needs an A record. The certificate name must match the domain.
- **Mini App:** its URL is set in BotFather, as the Main Mini App or as the menu button, and it opens by a direct link such as `https://t.me/botusername/appname`. The documentation allows HTTP links without TLS only in the test environment, so serve a real app over HTTPS.
- **Since 20 July 2026** Mini App methods stop working when they are called from a domain other than the Mini App's original one. Keep the app and its pages on one domain and do not change it casually.
- **Behind Cloudflare** use port 443 or 8443 for a webhook: port 88 is not on Cloudflare's list of proxied HTTPS ports.

## Does your bot or app need a domain

| What you build | Domain needed | Why |
| --- | --- | --- |
| A bot on long polling (`getUpdates`) | No | The bot makes outgoing requests only |
| A bot on a webhook | Yes, or a server IP with a self-signed certificate | Telegram sends updates to your HTTPS address |
| A Mini App | Yes | A Mini App is a web page with its own URL |
| Telegram login on a website | Yes, the site's domain | Telegram processes logins only for URLs you registered in BotFather |

A domain is not the only option for a webhook: Telegram's [webhook guide](https://core.telegram.org/bots/webhooks) says a self-signed certificate may use the server's IP as its common name. For anything you plan to keep, a domain with a normal certificate is easier: you can move the server without changing the address.

## Webhook: what Telegram requires

Everything below comes from Telegram's [webhook guide](https://core.telegram.org/bots/webhooks) and the description of [setWebhook](https://core.telegram.org/bots/api#setwebhook).

| Requirement | What the documentation says |
| --- | --- |
| Protocol | HTTPS only: a plain-text HTTP webhook is not possible |
| TLS version | TLS 1.2 and newer |
| Ports | 443, 80, 88 and 8443; other ports do not work |
| IP version | IPv4; IPv6 is currently not supported for webhooks |
| Certificate name | The common name (CN) or a subject alternative name (SAN) must match the domain where the bot is hosted |
| Self-signed certificate | Allowed: upload the public key in PEM format with `setWebhook`; the CN may be an IP |
| Where requests come from | Subnets 149.154.160.0/20 and 91.108.4.0/22 |
| Request check | The `secret_token` parameter (1–256 characters) comes back in the `X-Telegram-Bot-Api-Secret-Token` header |

Setting and checking a webhook takes two requests:

```text
curl "https://api.telegram.org/bot<TOKEN>/setWebhook" \
  -d "url=https://bot.example.com/telegram" \
  -d "secret_token=<random string>"

curl "https://api.telegram.org/bot<TOKEN>/getWebhookInfo"
```

In the `getWebhookInfo` answer look at `last_error_message` and `pending_update_count`. An empty error and a queue of zero mean updates are being delivered. A message that mentions SSL or certificate verification points to the certificate name or the chain.

## Mini App: where the URL goes

The [Mini Apps documentation](https://core.telegram.org/bots/webapps) describes two ways to attach an app to a bot:

- **The menu button.** For all users it is configured in BotFather with the `/setmenubutton` command or under Bot Settings > Menu Button: you give the button text and the Mini App URL.
- **The Main Mini App.** It is set up in BotFather too and opens by the direct link `https://t.me/botusername?startapp`. Other apps open by `https://t.me/botusername/appname`.

On the server, treat the `initData` that Telegram passes to the page as untrusted until you validate it: the documentation carries a warning to validate this data before using it on the bot's server.

For a website with Telegram login the current flow is described in [Telegram login](https://core.telegram.org/bots/telegram-login): in the BotFather mini app you select the bot, choose Login Widget and add every allowed URL, both the site's origin and the redirect addresses. Telegram processes logins only for URLs registered that way. Older guides mention the `/setdomain` command; that belongs to the archived legacy widget.

## The rule of 20 July 2026

The Bot API [changelog](https://core.telegram.org/bots/api-changelog) for version 10.2 (14 July 2026) reads: "Hardened the security of Mini Apps by disallowing the usage of Mini App methods from origins different from the original Mini App domain." The protection was enabled automatically for all Mini Apps on 20 July 2026, a developer can opt out through the BotFather Mini App, and the changelog adds that the bot is responsible for the Mini App having no links to untrusted sites.

What this means for the domain:

- **The domain is the app's identity.** A page on another domain, for example an external payment or form page that you open inside the app, cannot call Mini App methods.
- **Changing the domain is a migration.** The new URL goes into BotFather and every page of the app has to live on the new domain. Plan the name before launch.
- **A temporary address is a risk.** On a free subdomain of a hosting platform the name belongs to the platform. Your own domain stays yours when you change servers.
- **Subdomains are untested ground.** Telegram's text does not spell out how a subdomain of the same domain is treated, so test your layout instead of assuming.

## Cloudflare in front of a bot or an app

Cloudflare's [list of ports](https://developers.cloudflare.com/fundamentals/reference/network-ports/) says it proxies HTTPS traffic on 443, 2053, 2083, 2087, 2096 and 8443. The overlap with Telegram's webhook ports is 443 and 8443. Port 88 is not on Cloudflare's list, so a webhook on :88 will not pass through the proxy, and port 80 is plain HTTP, which a webhook cannot use.

- **SSL/TLS mode.** Choose Full (strict) if the server has a valid certificate. Flexible encrypts only the visitor's leg, and a server that redirects to https itself then ends in a redirect loop; details are in [Connect a domain to Cloudflare](https://rikidomains.at/en/guides/connect-domain-to-cloudflare/).
- **An A record for the webhook host.** Telegram does not use IPv6 for webhooks, so a host that has only an AAAA record will not receive updates.
- **Firewall and WAF.** If you filter by address or country, allow Telegram's subnets for the webhook path.

## Choosing and buying the domain

Telegram's documentation sets no requirements for the zone, so the choice is about budget and stability. Standard plan domains at Riki Domains start from $2.45 for the first year (web panel search of 27 November 2026), and the price differs a lot by zone:

| Zone | Note |
| --- | --- |
| .top, .xyz and other cheap Standard zones | Enough for a test or a small tool |
| .app | Google's zone: the whole .app zone is on the HSTS preload list, so browsers open it only over HTTPS |
| .com | The universal choice for a project you plan to keep |

The exact amount for your name is shown in the cart before payment; prices by zone are on the [prices page](https://rikidomains.at/en/prices/). WHOIS privacy in Standard zones is an option at $10 a year per domain. The purchase is paid from a crypto balance, and the account needs no email or documents: [how to buy a domain with crypto](https://rikidomains.at/en/guides/buy-domain-with-crypto/).

## Step by step

1. **Buy the domain** in the bot [@riki_domains_bot](https://t.me/riki_domains_bot?start=g50) or in the [web panel](https://rikidomains.at/en/guides/how-to-buy-a-domain-in-the-web-panel/).
2. **Connect it to Cloudflare**, automatically through the integration or by hand with a nameserver change.
3. **Create the record.** For your own server, an A record such as `app` or `bot` with its IP, proxy on. For a platform such as Pages, Vercel or Netlify, add the domain in the platform's dashboard and create the record it asks for, usually a CNAME.
4. **Set SSL/TLS to Full (strict)** and wait until the certificate is issued.
5. **Check from outside:** `curl -I https://app.example.com` should answer 200 with no certificate error.
6. **Tell Telegram.** Call `setWebhook` for a bot, or enter the URL in BotFather for a Mini App.
7. **Test and validate.** Open the Mini App from the bot, check `getWebhookInfo`, and make sure the server validates `initData`.

> [Open the bot](https://t.me/riki_domains_bot?start=g50)

## Typical errors

| Symptom | Likely cause | What to do |
| --- | --- | --- |
| `getWebhookInfo` shows an SSL or certificate verification error | The certificate is for another name, expired or has an incomplete chain | Check that the CN or SAN includes your domain; with Cloudflare use a proxied record and Full (strict) |
| Connection timed out | A port outside 443, 80, 88 and 8443, a firewall, or an IPv6-only host | Use 443 or 8443, allow Telegram's subnets, add an A record |
| Updates stopped after the move to Cloudflare | The webhook URL uses port 88 or another port Cloudflare does not proxy | Move the webhook to 443 or 8443 |
| The Mini App opens a blank page or a security warning | An HTTP address, or http:// resources on an HTTPS page | An HTTPS URL and no insecure resources |
| ERR_TOO_MANY_REDIRECTS | Cloudflare in Flexible mode with a server that redirects to https | Full (strict) |
| Mini App methods stop working after a navigation | The page is on another domain; the origin rule of 20 July 2026 | Keep the app's pages on its own domain |

## Checklist

1. Decide whether you need a webhook and a Mini App at all, or whether long polling is enough.
2. Choose a zone and a name you will not have to change.
3. Buy the domain and connect it to Cloudflare.
4. Create the record for the host and set Full (strict).
5. Set the webhook with a `secret_token` and check `getWebhookInfo`.
6. Enter the Mini App URL in BotFather and keep all its pages on that domain.
7. Validate `initData` on the server.

The domain for a bot or Mini App costs a few dollars and takes minutes to connect. What deserves time is the name: after 20 July 2026 it is tied to the app, and moving it later means redoing the BotFather setup and every link inside the app.

## FAQ

**Do I need a domain for a Telegram bot?**

Not if the bot gets updates by long polling: it asks Telegram for them itself. A domain is needed for a webhook, where Telegram sends updates to your HTTPS address, and for a Mini App, which is a web page with its own URL. For a webhook Telegram also accepts a server IP with a self-signed certificate, but a domain with an ordinary certificate is easier to maintain.

**Can a Telegram Mini App run on plain HTTP?**

Telegram's documentation allows HTTP links without TLS only in the test environment, which is separate from the main one and needs its own account and bot. A Mini App for real users should be served over HTTPS.

**Which ports can a Telegram webhook use?**

443, 80, 88 and 8443, always over TLS. Behind Cloudflare use 443 or 8443: Cloudflare's list of proxied HTTPS ports includes both and does not include 88.

**What changed for Mini Apps on 20 July 2026?**

Bot API 10.2 (14 July 2026) announced that Mini App methods can no longer be used from origins different from the original Mini App domain, and Telegram turned the protection on automatically for all Mini Apps on 20 July 2026. A developer can opt out through the BotFather Mini App, but the changelog adds that the bot is responsible for having no links to untrusted sites in the Mini App.

**Which domain zone suits a Mini App?**

The documentation sets no requirements for the zone, so the choice is about budget and stability. A cheap Standard zone such as .top or .xyz is enough for a test or a small tool; a project you plan to keep for years is better placed on a domain you can renew reliably, because the domain is tied to the Mini App's identity.
