Skip to content

archlinux 镜像对于不存在的文件未返回 404 状态码 #51

@yingziwu

Description

@yingziwu

对于不存在的资源,应当返回 404 状态码,但目前返回了一个 301 至主页的响应。
这将导致 pacman 无法怱略该镜像。

例如:pacman.conf 中 Server 放更新快的镜像,CacheServer 放下载速度快的镜像。
当 CacheServer 更新延后时,可能导致部分请求文件不存。若正常返回404响应,pacman 将尝试从下一个 CacheServer 下载直至回落至 Server。但 mirror.redrock.team 错误地了返回301响应,pacman 因此错误地从该镜像下载,进而导致更新出错。

Image

$ curl -vL --user-agent "pacman/7.0.0 (Linux x86_64) libalpm/15.0.0" https://mirror.redrock.team/archlinux/extra/os/x86_64/gocryptfs-2.7.1-1-x86_64.pkg.tar.zst
* Host mirror.redrock.team:443 was resolved.
* IPv6: 240e:630:25c0:7:222:177:140:110
* IPv4: 222.177.140.110
*   Trying [240e:630:25c0:7:222:177:140:110]:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: none
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* 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_256_GCM_SHA384 / x25519 / id-ecPublicKey
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=mirrors.cqupt.edu.cn
*  start date: Dec  6 04:45:07 2024 GMT
*  expire date: Mar  6 04:45:06 2025 GMT
*  subjectAltName: host "mirror.redrock.team" matched cert's "mirror.redrock.team"
*  issuer: C=US; O=Let's Encrypt; CN=E6
*  SSL certificate verify ok.
*   Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA384
*   Certificate level 1: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha256WithRSAEncryption
* Connected to mirror.redrock.team (240e:630:25c0:7:222:177:140:110) port 443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://mirror.redrock.team/archlinux/extra/os/x86_64/gocryptfs-2.7.1-1-x86_64.pkg.tar.zst
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: mirror.redrock.team]
* [HTTP/2] [1] [:path: /archlinux/extra/os/x86_64/gocryptfs-2.7.1-1-x86_64.pkg.tar.zst]
* [HTTP/2] [1] [user-agent: pacman/7.0.0 (Linux x86_64) libalpm/15.0.0]
* [HTTP/2] [1] [accept: */*]
> GET /archlinux/extra/os/x86_64/gocryptfs-2.7.1-1-x86_64.pkg.tar.zst HTTP/2
> Host: mirror.redrock.team
> User-Agent: pacman/7.0.0 (Linux x86_64) libalpm/15.0.0
> Accept: */*
> 
* Request completely sent off
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 301 
< server: nginx/1.26.0
< date: Sat, 01 Feb 2025 16:25:01 GMT
< content-type: text/html
< content-length: 169
< location: https://mirrors.cqupt.edu.cn
* Ignoring the response-body
* setting size while ignoring
< 
* Connection #0 to host mirror.redrock.team left intact
* Issue another request to this URL: 'https://mirrors.cqupt.edu.cn/'
* Host mirrors.cqupt.edu.cn:443 was resolved.
* IPv6: 240e:630:25c0:7:222:177:140:110
* IPv4: 222.177.140.110
*   Trying [240e:630:25c0:7:222:177:140:110]:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* 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_256_GCM_SHA384 / x25519 / id-ecPublicKey
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=mirrors.cqupt.edu.cn
*  start date: Dec  6 04:45:07 2024 GMT
*  expire date: Mar  6 04:45:06 2025 GMT
*  subjectAltName: host "mirrors.cqupt.edu.cn" matched cert's "mirrors.cqupt.edu.cn"
*  issuer: C=US; O=Let's Encrypt; CN=E6
*  SSL certificate verify ok.
*   Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA384
*   Certificate level 1: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using sha256WithRSAEncryption
*   Certificate level 2: Public key type RSA (4096/152 Bits/secBits), signed using sha256WithRSAEncryption
* Connected to mirrors.cqupt.edu.cn (240e:630:25c0:7:222:177:140:110) port 443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://mirrors.cqupt.edu.cn/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: mirrors.cqupt.edu.cn]
* [HTTP/2] [1] [:path: /]
* [HTTP/2] [1] [user-agent: pacman/7.0.0 (Linux x86_64) libalpm/15.0.0]
* [HTTP/2] [1] [accept: */*]
> GET / HTTP/2
> Host: mirrors.cqupt.edu.cn
> User-Agent: pacman/7.0.0 (Linux x86_64) libalpm/15.0.0
> Accept: */*
> 
* Request completely sent off
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 200 
< server: nginx/1.26.0
< date: Sat, 01 Feb 2025 16:25:01 GMT
< content-type: text/html; charset=utf-8
< content-length: 1062
< accept-ranges: bytes
< etag: "d5ojki5kdr0gti"
< last-modified: Sun, 17 Nov 2024 14:59:49 GMT
< vary: Accept-Encoding
< 
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <script>
      (function() {
        try {
          const savedTheme = localStorage.getItem('theme-preference')
          const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
          const hour = new Date().getHours()
          const isNight = hour >= 18 || hour < 6
          
          const shouldBeDark = savedTheme 
            ? JSON.parse(savedTheme)
            : prefersDark || isNight
            
          if (shouldBeDark)
            document.documentElement.classList.add('dark')
        } catch (e) {}
      })()
    </script>
    <link rel="icon" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>重庆邮电大学开源镜像站 | CQUPT OpenSource Mirror</title>
    <script type="module" crossorigin src="/assets/index-D7_fZJQR.js"></script>
    <link rel="stylesheet" crossorigin href="/assets/index-BoWOIiho.css">
  </head>
  <body>
    <div id="app"></div>
  </body>
</html>
* Connection #1 to host mirrors.cqupt.edu.cn left intact

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions