Skip to main content

FAQ

RequestResponse
Accept-EncodingContent-Encoding
  • Response
    • Accept-Ranges: bytes|none - 是否支持部分请求
Accept-Encoding: br;q=1.0, gzip;q=0.8, *;q=0.1
Range: bytes=200-1000, 2000-6576, 19000-

Transfer-Encoding vs Content-Encoding

  • Transfer-Encoding - 可动态修改 - 传输层
  • Content-Encoding - 不要动态修改 - 业务逻辑层
    • 大多客户端实现都使用 Content-Encoding 检测压缩

# 返回 content-encoding: gzip
curl -H 'Accept-encoding: gzip' -I https://s.wener.me

curl -H 'Accept-encoding: zstd, br, gzip, deflate' -I https://s.wener.me

301 vs 302

  • 301 Moved Permanently
    • 永久,客户端下次可能直接映射重定向后的地址
  • 302 Found / Moved Temporarily
    • 临时,还会再请求
  • 303 See Other
    • 特定语义
  • 307 Temporary Redirect
    • 请求重发
    • 支持 POST
  • 308 Permanent Redirect
    • 类似 301 但不允许修改 method

HTTP SEARCH/QUERY Method

  • GET 支持缓存,但不能携带 Body 请求
  • POST 可以用作查询,但不能缓存
  • 目前应该会支持 QUERY 方法

HTTP SEARCH is a new HTTP method, for safe requests that include a request body. It's still early & evolving, but it was recently adopted as an IETF draft standard, and it's going to add some great new tools for HTTP development everywhere.

-- httptoolkit


Accept-Encoding

Real IP

  • X-Forwarded-For
    • 反向代理
    • X-Forwarded-For: <client>, <proxy1>, <proxy2>
  • Forwarded
    • RFC 7239
    • Forwarded: for=<client-ip>, for=<proxy1>;proto=https;by=<proxy2>
  • X-Real-IP
    • Nginx
  • CF-Connecting-IP
    • Cloudflare
    • CF-Connecting-IP: <client-ip>
  • True-Client-Ip
    • Cloudflare Enterprise
    • Akamai CDN
    • True-Client-IP: <client-ip>
  • X-Cluster-Client-IP
    • AWS Elastic Load Balancer
    • X-Cluster-Client-IP: <client-ip>
  • cf-ray
  • cf-visitor

  • Proxy
    • Via: <protocol> <hostname>
    • X-Forwarded-Proto
    • X-Forwarded-Host
  • Request-Start: t=1672531200
  • X-Request-ID
  • Request-ID