Skip to content

H2 & H2C

名称: h2, h2c

状态: GA

H2使用HTTP2(HTTP2 Over TLS)或HTTP2 ClearText(HTTP2 Without TLS)协议与HTTP2服务建立数据通道。

H2

gost -L :8080 -F http+h2://:8443
services:
- name: service-0
  addr: ":8000"
  handler:
    type: auto
    chain: chain-0
  listener:
    type: tcp
chains:
- name: chain-0
  hops:
  - name: hop-0
    nodes:
    - name: node-0
      addr: :8443
      connector:
        type: http
      dialer:
        type: h2
        metadata:
          path: /ws
          header:
            foo: bar

H2C

gost -L :8080 -F http+h2c://:8443
services:
- name: service-0
  addr: ":8080"
  handler:
    type: auto
    chain: chain-0
  listener:
    type: tcp
chains:
- name: chain-0
  hops:
  - name: hop-0
    nodes:
    - name: node-0
      addr: :8443
      connector:
        type: http
      dialer:
        type: h2c
        metadata:
          path: /h2
          header:
            foo: bar

参数列表

host (string)
指定HTTP请求Host头部字段值
path (string)
请求URI
header (map)
自定义HTTP请求头

TLS配置请参考TLS配置说明