---
url: /configuration/dns/server/https.md
description: 通过 DNS over HTTPS 询问上游
---

# HTTPS

以 DNS message body 的 HTTP POST 询问 DoH 服务器。

```yaml check
dns:
  servers:
    up:
      type: https
      address: 127.0.0.1:443
      path: /dns-query
      tls:
        server_name: dns.example
      headers:
        X-Asked-By: mayami
  final: up
```

## 字段

### type

* 类型：字符串。
* 必填：是，第一项。
* 取值：`https`。

### address

* 类型：地址，可带端口。
* 必填：是。
* 默认端口：`443`。

### path

* 类型：字符串。
* 默认：`/dns-query`。
* 范围：必须以 `/` 开头，例如 `/dns-query`；配置检查会拒绝相对路径。

### via

* 类型：出站名或 `RULES`。
* 必填：可选。

### tls

* 类型：[TLS 客户端占位页](/configuration/shared/tls-client)。
* 默认：公共根证书，HTTP ALPN 为 `h2`。

### headers

* 类型：字符串到字符串的映射。
* 默认：空。
* 行为：检查 HTTP header 名和值；`Host` 会指定请求 authority。

### domain_resolver

* 类型：DNS 服务器名。
* 必填：可选。

## 说明

每个查询使用 DNS ID 0，内容类型为 `application/dns-message`。HTTP/2 连接由 server/worker 复用。

## 相关

* [DNS 服务器总览](/configuration/dns/server/)
* [共享 TLS 客户端](/configuration/shared/tls-client)
