421

개요

421 Misdirected Request는 요청이 그 scheme/authority(호스트)에 대한 응답을 만들 수 없는 서버에 도달했다는 뜻입니다. 즉 '잘못 배달된 요청'입니다.

가장 흔한 원인은 HTTP/2의 연결 재사용(connection coalescing)입니다. 브라우저는 TLS 인증서가 여러 도메인을 커버하고 IP가 같으면 하나의 연결을 여러 호스트에 재사용하는데, 정작 그 서버가 해당 호스트를 서비스하지 않으면 421을 반환합니다.

언제 발생하나

요청 / 응답 예시

요청
GET /page HTTP/2
:authority: other.example.com
(reused connection whose TLS cert covers only www.example.com)
응답
HTTP/2 421 Misdirected Request
content-type: text/plain

This server cannot produce a response for the requested authority.

코드로 보기

# Reject requests whose Host does not match a configured vhost
server {
  listen 443 ssl default_server;
  return 421;
}
# Avoid HTTP/2 connection coalescing by resolving to the right host
curl --http1.1 --resolve www.example.com:443:203.0.113.10 \
  https://www.example.com/page

흔한 원인

해결 방법

실무 참고

관련 상태코드

관련 헤더

Host:authority

스펙 근거