github.com 子域名上的 https 请求返回错误的 301 重定向到域名

github.com 子域名上的 https 请求返回错误的 301 重定向到域名

第一的

执行时curl -iv4 https://support.github.com/contact我收到了 301 个带有位置的响应https://github.com/contact

显然,当针对 301 响应返回的位置执行 curl 时,我只得到 404 响应。

我的一些机器(Linux 主机或 docker 容器)从未受到影响,但有些却受到影响。出于某种原因,它似乎与我的网络有关。

当我尝试访问 api.github.com 子域时发现了这个问题,问题是一样的。

我已经打开了 github 支持票,但目前尚无答复。

该问题在网络浏览器中是相同的,因此它与 curl 根本无关。

因此,如果有人知道什么可能导致服务器错误地返回 https 上的 301 响应,我愿意接受任何建议

编辑:

查询失败

fail-host:~$ curl -iv4 https://support.github.com/contact
*   Trying 140.82.121.3...
* TCP_NODELAY set
* Connected to support.github.com (140.82.121.3) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com
*  start date: Mar 25 00:00:00 2021 GMT
*  expire date: Mar 30 23:59:59 2022 GMT
*  subjectAltName: host "support.github.com" matched cert's "*.github.com"
*  issuer: C=US; O=DigiCert, Inc.; CN=DigiCert High Assurance TLS Hybrid ECC SHA256 2020 CA1
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x5579f6dcac10)
> GET /contact HTTP/2
> Host: support.github.com
> User-Agent: curl/7.64.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 301
HTTP/2 301
< content-length: 0
content-length: 0
< location: https://github.com/contact
location: https://github.com/contact

<
* Connection #0 to host support.github.com left intact

成功查询:

fail-host:~$ curl -iv4 https://support.github.com/contact
*   Trying 140.82.121.3...
* TCP_NODELAY set
* Connected to support.github.com (140.82.121.3) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com
*  start date: Mar 25 00:00:00 2021 GMT
*  expire date: Mar 30 23:59:59 2022 GMT
*  subjectAltName: host "support.github.com" matched cert's "*.github.com"
*  issuer: C=US; O=DigiCert, Inc.; CN=DigiCert High Assurance TLS Hybrid ECC SHA256 2020 CA1
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x5579f6dcac10)
> GET /contact HTTP/2
> Host: support.github.com
> User-Agent: curl/7.64.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 301
HTTP/2 301
< content-length: 0
content-length: 0
< location: https://github.com/contact
location: https://github.com/contact

<
* Connection #0 to host support.github.com left intact

编辑:已修复

该问题在 github.com 上,请参阅:

将导致错误的 301 重定向: curl -v https://support.github.com/contact --resolve 'support.github.com:443:140.82.121.3'

将导致正确的 302 重定向: curl -v https://support.github.com/contact --resolve 'support.github.com:443:140.82.114.21'

到目前为止,github 还没有回复我的个人支持票。

答案1

该问题在 github.com 上,请参阅:

将导致错误的 301 重定向:curl -vhttps://support.github.com/contact--resolve 'support.github.com:443:140.82.121.3'

将导致正确的 302 重定向:curl -vhttps://support.github.com/contact--resolve 'support.github.com:443:140.82.114.21'

到目前为止,github 还没有回复我的个人支持票。

相关内容