Si su cliente presenta problemas con HTTP/2 sobre HTTPS y no es fácil modificar su configuración, deshabilite el protocolo HTTP/2 en la puerta de enlace de Alibaba Cloud Service Mesh (ASM). En este tema se describe cómo deshabilitar HTTP/2 para HTTPS en una puerta de enlace de entrada.
Requisitos previos
Paso 1: Comprobar la configuración predeterminada
Para comprobar que Application-Layer Protocol Negotiation (ALPN) usa HTTP/2 de forma predeterminada, ejecute a continuación el siguiente comando para acceder a la puerta de enlace de ASM. Reemplace <INGRESS_GATEWAY_IP> por la dirección IP de su puerta de enlace de entrada.
curl -k -H Host:b.aliyun.com --resolve b.aliyun.com:443:<INGRESS_GATEWAY_IP> https://b.aliyun.com/status/418 -v
Salida esperada:
* Added b.aliyun.com:443:8.217.xxx xxx to DNS cache
* Hostname b.aliyun.com was found in DNS cache
* Trying 8.217.xxx xxx:443...
* Connected to b.aliyun.com (8.217.xxx xxx) port 443 (#0)
* ALPN: offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted h2
* Server certificate:
* subject: CN=aliyun.com; O=myexample organization
* start date: Apr 10 08:23:54 2023 GMT
* expire date: Apr 9 08:23:54 2024 GMT
* issuer: O=myexample Inc.; CN=aliyun.com
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/2
* h2 [:method: HEAD]
* h2 [:scheme: https]
* h2 [:authority: b.aliyun.com]
* h2 [:path: /status/418]
* h2 [user-agent: curl/8.1.2]
* h2 [accept: */*]
* Using Stream ID: 1 (easy handle 0x12e80d600)
> HEAD /status/418 HTTP/2
> Host:b.aliyun.com
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/2 418
HTTP/2 418
< server: istio-envoy
server: istio-envoy
< date: Thu, 14 Sep 2023 08:23:25 GMT
date: Thu, 14 Sep 2023 08:23:25 GMT
< access-control-allow-origin: *
access-control-allow-origin: *
< x-more-info: http://tools.ietf.org/html/rfc2324
x-more-info: http://tools.ietf.org/html/rfc2324
< access-control-allow-credentials: true
access-control-allow-credentials: true
< content-length: 135
content-length: 135
< x-envoy-upstream-service-time: 5
x-envoy-upstream-service-time: 5
La salida muestra que el cliente ofrece tanto HTTP/2 como HTTP/1.1 en la lista de ALPN. De forma predeterminada, la puerta de enlace prefiere HTTP/2.
Paso 2: Deshabilitar HTTP/2 para HTTPS
Inicie sesión en la consola de ASM. En el panel de navegación izquierdo, elija .
En la página Mesh Management, haga clic en el nombre de la instancia de ASM. En el panel de navegación izquierdo, elija .
-
En la página Ingress Gateway, busque la puerta de enlace que desea configurar y haga clic en View YAML dentro de la columna Actions. En el cuadro de diálogo Edit, agregue la configuración
podAnnotationsdebajo del campospecy luego haga clic en OK.podAnnotations: proxy.istio.io/config: | httpsHttp2Disabled: trueNotaEsta configuración provoca que la puerta de enlace se reinicie.
Paso 3: Comprobar que HTTP/2 está deshabilitado para HTTPS
Ejecute de nuevo el siguiente comando para acceder a la puerta de enlace de ASM. Reemplace <INGRESS_GATEWAY_IP> por la dirección IP de su puerta de enlace de entrada.
curl -k -H Host:b.aliyun.com --resolve b.aliyun.com:443:<INGRESS_GATEWAY_IP> https://b.aliyun.com/status/418 -v
Salida esperada:
* Added b.aliyun.com:443:8.217.xxx.xxx to DNS cache
* Hostname b.aliyun.com was found in DNS cache
* Trying 8.217.xxx.xxx:443...
* Connected to b.aliyun.com (8.217.xxx.xxx) port 443 (#0)
* ALPN: offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN: server accepted http/1.1
* Server certificate:
* subject: CN=aliyun.com; O=myexample organization
* start date: Apr 10 08:23:54 2023 GMT
* expire date: Apr 9 08:23:54 2024 GMT
* issuer: O=myexample Inc.; CN=aliyun.com
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/1.1
> HEAD /status/418 HTTP/1.1
> Host:b.aliyun.com
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/1.1 418 Unknown
HTTP/1.1 418 Unknown
< server: istio-envoy
server: istio-envoy
< date: Thu, 14 Sep 2023 08:20:13 GMT
date: Thu, 14 Sep 2023 08:20:13 GMT
< access-control-allow-origin: *
access-control-allow-origin: *
< x-more-info: http://tools.ietf.org/html/rfc2324
x-more-info: http://tools.ietf.org/html/rfc2324
< access-control-allow-credentials: true
access-control-allow-credentials: true
< content-length: 135
content-length: 135
< x-envoy-upstream-service-time: 1
x-envoy-upstream-service-time: 1
La salida muestra que el protocolo ALPN aceptado por el servidor es HTTP/1.1. Esto confirma que HTTP/2 está deshabilitado.