시작하기
HTTP 요청 & 응답
HTTP는 요청-응답 프로토콜입니다. 클라이언트가 요청(메서드, 경로, 헤더, 선택적 본문)을 보내면 서버가 상태, 헤더, 본문으로 응답합니다. HTTP/1.1은 텍스트 기반이고, HTTP/2와 HTTP/3는 바이너리 프레이밍을 씁니다.
# HTTP Request
GET /api/users HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
Accept: application/json
# HTTP Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 45
{"id": 1, "name": "Alice", "email": "[email protected]"}URL 구조
URL이 리소스를 식별합니다. 스킴이 프로토콜을 고르고, 호스트는 DNS로 해석됩니다. 포트를 생략하면 기본 포트가 암시됩니다. 프래그먼트(#)는 클라이언트 전용이며 서버로 보내기 전에 제거됩니다. 쿼리 문자열은 흔히 필터링/페이징에 쓰입니다.
# Generic URL format
scheme://userinfo@host:port/path?query#fragment
# Example
https://user:[email protected]:8443/api/v1/users?page=2#section
# Components
# scheme - https (protocol)
# userinfo - user:pass (rare, deprecated)
# host - example.com (domain or IP)
# port - 8443 (default: 80 for http, 443 for https)
# path - /api/v1/users (resource location)
# query - page=2 (key=value pairs, & separated)
# fragment - section (client-only, never sent to server)HTTP 버전 개요
HTTP/0.9는 미니멀한 프로토타입이었습니다. HTTP/1.0은 헤더와 콘텐츠 타입을 더했지만 요청마다 새 연결을 열었습니다. HTTP/1.1은 지속 연결, 필수 Host 헤더(가상 호스트 가능), 파이프라이닝을 도입했습니다. HTTP/2는 바이너리 멀티플렉싱을 더했고, HTTP/3는 QUIC 위에서 실행되어 전송 계층의 HOL 블로킹을 없앱니다.
# HTTP/0.9 (1991) - single GET, no headers
GET /page.html
# HTTP/1.0 (1996) - headers, status codes, multiple types
GET /page.html HTTP/1.0
# HTTP/1.1 (1997) - persistent connections, Host header, pipelining
GET /page.html HTTP/1.1
Host: example.com
# HTTP/2 (2015) - binary, multiplexing, header compression
# (negotiated via ALPN or h2c upgrade)
# HTTP/3 (2022) - over QUIC (UDP-based)
# (negotiated via Alt-Svc header)연결 라이프사이클
HTTP/1.1은 기본적으로 TCP 연결을 유지해(keep-alive) 반복 핸드셰이크 비용을 피합니다. 하나의 연결로 여러 요청을 보낼 수 있습니다. Connection: close 헤더가 마지막 요청임을 신호합니다. HTTP/2는 단일 연결 위에서 많은 스트림을 멀티플렉싱합니다. Keep-Alive timeout과 max는 서버에서 설정 가능합니다.
# HTTP/1.1 persistent connection (keep-alive)
GET /page1 HTTP/1.1
Host: example.com
Connection: keep-alive
# (server responds, connection stays open)
HTTP/1.1 200 OK
Content-Length: 128
Connection: keep-alive
# Client reuses same TCP connection for next request
GET /page2 HTTP/1.1
Host: example.com
# Closing the connection
GET /final HTTP/1.1
Host: example.com
Connection: close메시지 형식
HTTP 메시지는 시작 줄(request-line 또는 status-line)로 시작하고 헤더, 빈 줄, 선택적 본문이 따릅니다. 줄은 CRLF 개행을 씁니다. 헤더 이름은 대소문자를 구분하지 않습니다. 빈 줄은 필수이며 본문의 시작을 알립니다. 본문은 임의 길이(chunked)나 고정(Content-Length)이 될 수 있습니다.
# Request format
<METHOD> <PATH> <VERSION>
<Header-Name>: <value>
...
<optional body>
# Response format
<VERSION> <STATUS> <REASON>
<Header-Name>: <value>
...
<optional body>
# Lines end with CRLF (
). Headers are case-insensitive.
# A blank line (
) separates headers from body.Telnet / Raw HTTP 디버깅
nc나 telnet(포트 80), openssl s_client(HTTPS)로 TCP 위에서 HTTP를 직접 말할 수 있습니다. 디버깅에 매우 유용합니다. HTTP/1.1+에서는 Host 헤더가 반드시 필요합니다. 빈 줄 두 개가 요청을 종료합니다. curl -v는 헤더를 포함한 와이어 형식 대화를 보여줍니다.
# Manual HTTP request via netcat/nc
nc example.com 80
GET / HTTP/1.1
Host: example.com
# (press Enter twice to send blank line)
# Using openssl for HTTPS
openssl s_client -connect example.com:443
GET / HTTP/1.1
Host: example.com
# curl with --http1.1 to force version
curl -v --http1.1 https://example.com
curl -v --http2 https://example.com
curl -v --http3 https://example.comHTTP 메서드
GET — 리소스 조회
GET은 리소스의 표현을 가져옵니다. 안전해야 하고(부수 효과 없음) 멱등해야(반복 가능) 합니다. GET 요청은 캐시 가능하고 즐겨찾기 가능합니다. 스펙상 본문이 허용되지만 권장되지 않습니다 — 프록시와 CDN이 제거할 수 있습니다. 필터링에는 쿼리 파라미터를 쓰세요.
# Basic GET
GET /api/users/42 HTTP/1.1
Host: api.example.com
Accept: application/json
# GET with query parameters
GET /api/users?role=admin&active=true HTTP/1.1
Host: api.example.com
# GET should be safe & idempotent
# - safe: no server state change
# - idempotent: repeating yields same result
# - cacheable: yes
# - body allowed but discouraged (some clients/servers reject)POST — 리소스 생성
POST는 처리할 데이터를 제출합니다. 서버가 URI를 지정하는 새 리소스 생성에 쓰입니다(예: /api/users → /api/users/43). POST는 안전하지도 멱등하지도 않습니다 — 두 번 제출하면 리소스 두 개가 만들어질 수 있습니다. 201 Created 응답은 새 리소스를 가리키는 Location 헤더를 포함해야 합니다.
# POST creating a new resource
POST /api/users HTTP/1.1
Host: api.example.com
Content-Type: application/json
Content-Length: 52
{"name": "Bob", "email": "[email protected]", "age": 30}
# Response typically 201 Created with Location header
HTTP/1.1 201 Created
Location: /api/users/43
Content-Type: application/json
{"id": 43, "name": "Bob"}
# POST is neither safe nor idempotent.
# Repeating may create duplicate resources.PUT — 리소스 교체
PUT은 대상 URI의 리소스 전체를 요청 본문으로 교체합니다. 멱등입니다 — 같은 PUT을 반복하면 같은 최종 상태가 됩니다. PUT은 컬렉션을 타깃하는 POST와 달리 특정 URI를 타깃합니다(예: /users/43). PUT에서 필드를 생략하면 보통 제거됩니다(전체 교체).
# PUT replaces the entire resource at the given URI
PUT /api/users/43 HTTP/1.1
Host: api.example.com
Content-Type: application/json
Content-Length: 60
{"id": 43, "name": "Robert", "email": "[email protected]", "age": 31}
# Idempotent: sending the same PUT again yields the same state.
# If the resource doesn't exist, PUT may create it (server-dependent).
# Response
HTTP/1.1 200 OK
# or 204 No Content if no body returnedPATCH — 부분 업데이트
PATCH는 전체를 교체하는 PUT과 달리 부분 업데이트를 적용합니다. 가장 단순한 형태는 JSON Merge Patch(RFC 7396)입니다: 바꿀 필드만 보냅니다. JSON Patch(RFC 6902)는 연산 배열(add, remove, replace, move, copy, test)을 씁니다. PATCH는 기본적으로 멱등이 아니지만 merge-patch는 멱등입니다.
# PATCH applies partial modifications
PATCH /api/users/43 HTTP/1.1
Host: api.example.com
Content-Type: application/merge-patch+json
Content-Length: 22
{"email": "[email protected]"}
# Only the email field is updated; other fields remain.
# JSON Patch (RFC 6902) - structured operations
PATCH /api/users/43 HTTP/1.1
Content-Type: application/json-patch+json
[
{"op": "replace", "path": "/email", "value": "[email protected]"},
{"op": "remove", "path": "/age"}
]DELETE — 리소스 제거
DELETE는 대상 리소스를 제거합니다. 멱등입니다 — 같은 리소스를 두 번 삭제해도 서버는 같은 상태에 있어야 합니다. 흔한 성공 코드는 204(본문 없음), 200(확인 본문 포함), 202(비동기 삭제)입니다. 대부분의 API는 인증을 요구합니다. 없는 리소스에 404를 반환할지는 논쟁적입니다 — 멱등성을 위해서는 204가 더 안전합니다.
# Delete a resource
DELETE /api/users/43 HTTP/1.1
Host: api.example.com
Authorization: Bearer <token>
# Successful responses:
HTTP/1.1 204 No Content # most common
HTTP/1.1 200 OK # if body returned
HTTP/1.1 202 Accepted # async deletion queued
# Idempotent: deleting an already-deleted resource
# should still return 204 (or 404 — debatable).HEAD & OPTIONS
HEAD는 GET과 같지만 서버가 헤더만 반환합니다(본문 없음) — 다운로드 없이 Content-Length, Content-Type, Last-Modified 확인에 유용합니다. OPTIONS는 허용된 메서드(Allow 헤더)를 묻고, 브라우저의 CORS 프리플라이트에 쓰입니다. 둘 다 안전하고 멱등입니다.
# HEAD: like GET but returns headers only (no body)
HEAD /api/users/42 HTTP/1.1
Host: api.example.com
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 128
# (no body)
# OPTIONS: describe communication options
OPTIONS /api/users HTTP/1.1
Host: api.example.com
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Access-Control-Allow-Methods: GET, POST상태 코드
1xx 정보
1xx 코드는 정보 제공용이며, 요청이 수신되었고 처리가 계속됨을 나타냅니다. 100 Continue는 큰 본문을 보낼지 클라이언트가 확인하게 합니다(Expect: 100-continue 헤더와 짝). 101 Switching Protocols가 WebSocket을 가능하게 합니다. 103 Early Hints는 최종 응답이 준비되기 전에 자산을 미리 로드하라고 브라우저에 힌트합니다.
# 100 Continue - server received headers, client may send body
POST /upload HTTP/1.1
Host: example.com
Expect: 100-continue
Content-Length: 1048576
# Server replies:
HTTP/1.1 100 Continue
# (client now sends the request body)
# 101 Switching Protocols - used for WebSocket upgrade
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
# 103 Early Hints - preload resources before final response
HTTP/1.1 103 Early Hints
Link: </style.css>; rel=preload; as=style2xx 성공
2xx 코드는 성공을 나타냅니다. 200 OK가 일반 성공입니다. 201 Created는 새 리소스가 만들어졌음을 나타냅니다(Location 헤더와 함께). 202 Accepted는 비동기 처리를 위해 대기 중임을 뜻합니다(예: 오래 걸리는 작업). 204 No Content는 본문 없는 성공을 신호합니다 — DELETE/PUT에 흔합니다. 206 Partial Content는 리소스의 일부를 반환합니다(Range 요청).
# 200 OK - standard success
HTTP/1.1 200 OK
# 201 Created - new resource created (POST/PUT)
HTTP/1.1 201 Created
Location: /api/users/43
# 202 Accepted - request queued for async processing
HTTP/1.1 202 Accepted
# 204 No Content - success, no body (DELETE, PUT)
HTTP/1.1 204 No Content
# 206 Partial Content - Range request result
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-1023/20483xx 리다이렉션
3xx 코드는 리다이렉션을 나타냅니다. 301/308은 영구이고(캐시됨, SEO 링크 점수 이전), 302/307은 임시입니다. 결정적 차이: 301과 302는 역사적으로 POST→GET 변환을 허용했습니다(데이터 손실 유발), 307과 308은 메서드를 엄격히 유지합니다. 304 Not Modified는 캐시가 유효할 때 조건부 요청에 반환됩니다 — 본문을 보내지 않습니다.
# 301 Moved Permanently - cacheable, change bookmarks
HTTP/1.1 301 Moved Permanently
Location: https://newsite.com/page
# 302 Found - temporary redirect (don't update bookmarks)
HTTP/1.1 302 Found
Location: /login
# 304 Not Modified - cache is still valid (conditional GET)
HTTP/1.1 304 Not Modified
ETag: "abc123"
# 307 Temporary Redirect - preserves method (POST stays POST)
HTTP/1.1 307 Temporary Redirect
Location: /new-endpoint
# 308 Permanent Redirect - permanent, preserves method
HTTP/1.1 308 Permanent Redirect
Location: https://newsite.com/api4xx 클라이언트 오류
4xx 코드는 클라이언트가 실수했다는 뜻입니다. 400 Bad Request는 잘못된 형식의 입력입니다. 401은 인증 없음/무효를 뜻합니다(WWW-Authenticate 포함 필요). 403은 인증됐지만 권한이 없다는 뜻입니다. 404는 리소스 없음입니다. 429는 레이트 리밋을 나타냅니다(Retry-After 포함). 기타 흔한 것: 405 Method Not Allowed, 409 Conflict, 422 Unprocessable Entity.
# 400 Bad Request - malformed syntax
HTTP/1.1 400 Bad Request
Content-Type: application/json
{"error": "Invalid JSON in request body"}
# 401 Unauthorized - authentication required
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="api"
# 403 Forbidden - authenticated but not allowed
HTTP/1.1 403 Forbidden
# 404 Not Found - resource doesn't exist
HTTP/1.1 404 Not Found
# 429 Too Many Requests - rate limit hit
HTTP/1.1 429 Too Many Requests
Retry-After: 605xx 서버 오류
5xx 코드는 서버가 실패했다는 뜻입니다. 500은 처리되지 않은 오류의 만능입니다(서버 로그 확인). 501은 서버가 메서드를 구현하지 않았다는 뜻입니다. 502는 프록시/게이트웨이가 업스트림에서 나쁜 응답을 받았다는 뜻입니다. 503은 일시적 과부하입니다(Retry-After 사용). 504는 업스트림 타임아웃입니다. 클라이언트는 백오프와 함께 502/503/504를 재시도할 수 있습니다.
# 500 Internal Server Error - generic server failure
HTTP/1.1 500 Internal Server Error
# 501 Not Implemented - server doesn't support the method
HTTP/1.1 501 Not Implemented
# 502 Bad Gateway - upstream server returned invalid response
HTTP/1.1 502 Bad Gateway
# 503 Service Unavailable - temporary overload or maintenance
HTTP/1.1 503 Service Unavailable
Retry-After: 300
# 504 Gateway Timeout - upstream didn't respond in time
HTTP/1.1 504 Gateway Timeout상태 코드 패턴
일관된 상태 코드 매핑이 API를 예측 가능하게 만듭니다. 성공에는 의미 정밀성을 갖춘 2xx(생성은 201, 본문 없음은 204)를 쓰세요. 클라이언트 오류에는 가장 구체적인 4xx(충돌은 409, 검증은 422)를 쓰세요. 401 vs 403이 가장 흔한 혼란입니다: 401 = '당신은 누구인가?', 403 = '누구인지는 알지만 이건 할 수 없다'.
# REST API common mapping
GET /users -> 200
POST /users -> 201 (Created)
GET /users/42 -> 200 | 404
PUT /users/42 -> 200 | 201 (if created) | 404
PATCH /users/42 -> 200 | 404
DELETE /users/42 -> 204 | 404
# Validation errors
400 -> malformed JSON, missing required field
409 -> duplicate resource / version conflict
422 -> semantic validation failure (some APIs)
# Auth flow
401 -> no/invalid token (login required)
403 -> logged in but lacking permission
404 -> hide existence from unauthorized users
# Use 418 I'm a teapot for fun (RFC 2324 joke).요청 헤더
흔한 요청 헤더
흔한 요청 헤더는 클라이언트 정체(User-Agent), 원하는 응답 형식(Accept 계열), 연결 제어(Connection), 인증(Authorization), 상태(Cookie), 출처(Referer/Origin)를 전달합니다. Host는 HTTP/1.1+에서 가상 호스팅을 위해 필수입니다. Content-Type과 Content-Length가 요청 본문이 있을 때 이를 기술합니다.
GET /api/data HTTP/1.1
Host: api.example.com # target host (mandatory in HTTP/1.1)
User-Agent: Mozilla/5.0 # client identity
Accept: application/json # desired response format
Accept-Language: en-US,en;q=0.9
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Authorization: Bearer <token>
Cookie: session=abc123; theme=dark
Referer: https://example.com/
Origin: https://example.com
Content-Type: application/json
Content-Length: 42Accept 헤더 (콘텐츠 협상)
Accept 계열이 콘텐츠 협상을 이끕니다. 품질 값(q, 0-1)이 선호도를 표현합니다 — 높을수록 선호됩니다. */*는 만능 와일드카드입니다. 서버가 지원하는 것 중 최적 매칭을 고르며, 하나도 없으면 406 Not Acceptable을 반환합니다(대부분의 서버는 406 대신 기본 형식으로 폴백합니다). Brotli(br)와 zstd는 gzip보다 압축이 좋습니다.
# Accept: desired media types with quality (q) values
Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8
# Accept-Language: preferred languages
Accept-Language: en-US,en;q=0.9, zh-CN;q=0.8, fr;q=0.7
# Accept-Encoding: accepted compression algorithms
Accept-Encoding: gzip, deflate, br, zstd;q=0.9
# q=1.0 is default. Higher q = more preferred.
# */* matches any type.
# Server responds with 406 Not Acceptable if it can't satisfy.Authorization & 인증 헤더
Authorization이 자격 증명을 운반합니다. Basic 인증은 base64 인코딩된 username:password를 매 요청에 보냅니다(항상 HTTPS 사용). Bearer 토큰은 불투명 문자열(보통 JWT)로 OAuth 2.0에서 쓰입니다. 커스텀 인증 방식(X-API-Key)은 API 게이트웨이에서 흔합니다. Basic 인증의 base64는 인코딩이지 암호화가 아닙니다 — TLS 없이는 보안이 없습니다.
# Basic Authentication (base64 of user:pass)
Authorization: Basic dXNlcjpwYXNz
# dXNlcjpwYXNz = base64("user:pass")
# Bearer Token (OAuth 2.0 / JWT)
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
# API Key in header (custom)
X-API-Key: abc123def456
# Proxy authentication
Proxy-Authorization: Basic dXNlcjpwYXNz
# WARNING: Basic auth sends credentials on every request.
# Always use HTTPS to prevent eavesdropping.User-Agent & Referer
User-Agent가 클라이언트를 식별하지만, 대부분의 브라우저는 하위 호환성(역사적 스니핑)을 위해 Mozilla/5.0을 가장합니다. Referer(스펙의 오타, 끝내 고쳐지지 않음)는 어떤 페이지가 요청으로 연결됐는지 서버에 알려줍니다 — 분석과 핫링크 보호에 쓰입니다. Origin은 스킴+호스트+포트이며, 브라우저가 CORS 요청과 POST에서 보냅니다.
# User-Agent identifies the client software
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
# Common browsers prepend "Mozilla/5.0" for historical compatibility
# (servers used to serve different content to different browsers)
# Referer: page that linked to this request
Referer: https://example.com/search?q=hello
# Origin: scheme + host + port (used by CORS)
Origin: https://example.com
# Note: "Referer" is the official spelling (misspelled in the original spec)조건부 요청 헤더
조건부 헤더는 효율적인 캐싱과 동시성 제어를 가능하게 합니다. If-None-Match(ETag와)와 If-Modified-Since(Last-Modified와)가 GET을 조건부로 만들어 — 캐시가 유효하면 서버가 304를 반환합니다. If-Match와 If-Unmodified-Since는 PUT/PATCH를 잃어버린 업데이트로부터 지킵니다(낙관적 동시성). If-Range는 원자적 범위 요청을 가능하게 합니다.
# Conditional GET - only fetch if changed
If-Modified-Since: Wed, 21 Oct 2023 07:28:00 GMT
If-None-Match: "abc123"
# If-Match / If-Unmodified-Since - for safe PUT/PATCH
If-Match: "abc123"
If-Unmodified-Since: Wed, 21 Oct 2023 07:28:00 GMT
# If-Range - for range requests (all-or-nothing)
If-Range: "abc123"
Range: bytes=0-1023
# Typical flow:
# 1. Server sends ETag/Last-Modified with response
# 2. Client sends If-None-Match/If-Modified-Since on next request
# 3. Server replies 304 if unchanged, 200 if changed커스텀 & X-헤더
커스텀 헤더는 역사적으로 X- 접두사를 썼지만 RFC 6648이 2012년 이 관례를 폐기했습니다. 새 헤더는 X-를 빼야 합니다(예: X-Request-ID가 아닌 Request-ID). X-Forwarded-For와 X-Forwarded-Proto는 프록시를 통과해 클라이언트 정보를 운반합니다(주의: 위조 가능). 표준화된 대안은 Forwarded(RFC 7239)입니다. Traceparent/Tracestate가 분산 트레이싱(W3C)을 가능하게 합니다.
# X- prefixed headers (deprecated convention, but widely used)
X-Request-ID: 550e8400-e29b-41d4-a716-446655440000
X-Correlation-ID: abc-123
X-Forwarded-For: 203.0.113.1, 70.41.3.18
X-Forwarded-Proto: https
X-Real-IP: 203.0.113.1
X-RateLimit-Remaining: 42
# Modern recommendation: avoid X- prefix (RFC 6648)
# Use a namespace instead:
Request-ID: 550e8400-e29b-41d4-a716-446655440000
Traceparent: 00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01
# Forwarded (RFC 7239) - standardized proxy info
Forwarded: for=203.0.113.1; proto=https; host=example.com응답 헤더
흔한 응답 헤더
흔한 응답 헤더는 서버(Server), 응답 본문(Content-Type, Content-Length), 연결 제어(Connection), 캐싱(Cache-Control, ETag, Last-Modified), 콘텐츠 협상(Vary), 상태(Set-Cookie), CORS(Access-Control-*)을 기술합니다. Date는 필수이며 GMT의 RFC 1123 형식을 씁니다.
HTTP/1.1 200 OK
Server: nginx/1.25.0
Date: Wed, 21 Oct 2023 07:28:00 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 128
Connection: keep-alive
Cache-Control: public, max-age=3600
ETag: "abc123"
Last-Modified: Mon, 20 Oct 2023 10:00:00 GMT
Vary: Accept-Encoding
Set-Cookie: session=xyz; HttpOnly; Secure
Access-Control-Allow-Origin: https://example.com콘텐츠 헤더
Content-* 헤더가 본문을 기술합니다. Content-Type은 MIME 타입이며 핵심입니다. Content-Length는 정확한 바이트 수입니다(chunked 인코딩을 쓰지 않으면 필수). Content-Encoding은 압축을 나타냅니다(gzip, br). Content-Disposition은 파일명과 함께 다운로드를 강제합니다. Content-Range는 206 Partial Content 응답에 따라옵니다.
# Body metadata
Content-Type: application/json; charset=utf-8
Content-Length: 128 # exact byte count
Content-Encoding: gzip # applied encoding
Content-Language: en-US
Content-Location: /api/users/42.json
Content-Disposition: attachment; filename="report.pdf"
Content-Range: bytes 0-1023/2048 # for partial content
# For chunked transfer (no Content-Length known upfront)
Transfer-Encoding: chunked
# MIME type format: type/subtype; parameter=value
# e.g., text/html; charset=UTF-8보안 헤더
보안 헤더는 흔한 공격에 대해 브라우저를 강화합니다. HSTS는 HTTPS를 강제하고 SSL 스트리핑을 막습니다. X-Content-Type-Options: nosniff는 MIME 스니핑을 막습니다. X-Frame-Options(또는 CSP frame-ancestors)는 클릭재킹을 막습니다. CSP가 가장 강력합니다 — 어떤 리소스가 로드·실행될 수 있는지 제어합니다. Referrer-Policy는 새어 나가는 리퍼러 정보를 제한합니다. 모든 응답에 설정하세요.