HTTP 헤더 목록
그 헤더가 하는 일과, 사람들이 틀리는 지점.
- 헤더
- 36
출력
Cache-Control (both)
How long this may be reused and by whom. max-age=31536000, immutable for a fingerprinted asset; no-store for anything private. "no-cache" does not mean do not cache — it means revalidate before reuse, which is the single most misread value in HTTP.
ETag (response)
A version tag for the body. The browser sends it back in If-None-Match and a match answers 304 with no body. Cheaper than Last-Modified because it does not depend on clocks.
Last-Modified (response)
When the body last changed, to the second. Paired with If-Modified-Since. One-second resolution means a file changed twice in a second can be served stale.
Vary (response)
Which request headers change this response, so a cache does not serve the wrong one. Vary: Accept-Encoding is nearly always right; Vary: User-Agent nearly always destroys your hit rate.
Content-Type (both)
What the bytes are. Wrong here and a browser refuses to act: an SVG as text/plain does not render, a .vtt as text/plain is ignored and the video plays with no captions and no error.
Content-Disposition (response)
inline to display, attachment to download. filename*=UTF-8''... is how a non-ASCII filename survives; the plain filename= parameter is ASCII only.
Content-Encoding (response)
The compression applied to the body — gzip, br, zstd. Not the character set, which goes in Content-Type.
Content-Length (both)
The body size in bytes. Omitted when chunked; getting it wrong truncates or hangs the response.
Authorization (request)
Credentials. Bearer <token> for OAuth, Basic <base64 user:pass> for the old scheme. Never logged, and never in a URL where it would be.
WWW-Authenticate (response)
Sent with 401 to say which scheme to authenticate with. A 401 without it is incomplete, and some clients will not retry.
Set-Cookie (response)
Sets a cookie. Secure, HttpOnly and SameSite are the three that matter; without HttpOnly a script can read it, and without Secure it travels in the clear.
Cookie (request)
Cookies going back. Sent on every request to the origin, which is why a large cookie is a tax on every page load.
Strict-Transport-Security (response)
Forces HTTPS for this host for max-age seconds. includeSubDomains covers everything under it. Hard to undo — a long max-age set by mistake locks out a subdomain until it expires.
Content-Security-Policy (response)
What the page may load and run. The one header that actually stops cross-site scripting rather than reporting it. unsafe-inline in script-src gives most of the protection back.
X-Content-Type-Options (response)
nosniff: take Content-Type literally instead of guessing from the bytes. One value, no downside, and it closes a whole class of upload attacks.
X-Frame-Options (response)
DENY or SAMEORIGIN to stop the page being framed. Superseded by frame-ancestors in CSP, which is more expressive; send both while old browsers remain.
Referrer-Policy (response)
How much of the current URL is sent on to the next site. strict-origin-when-cross-origin is the modern default and keeps paths and query strings inside your own origin.
Permissions-Policy (response)
Which browser features this document and its frames may use — camera, geolocation, microphone. Replaces Feature-Policy.
Access-Control-Allow-Origin (response)
Which origin may read the response. A single origin or *, never a list. With credentials it may not be * — that pairing is the commonest CORS failure.
Access-Control-Allow-Credentials (response)
true lets the browser send cookies cross-origin. Requires an exact origin in Allow-Origin, not a wildcard.
Access-Control-Allow-Methods (response)
Which methods the preflight permits. Only consulted on the OPTIONS preflight, not on the real request.
Access-Control-Allow-Headers (response)
Which request headers the preflight permits. A custom header the client sends must be listed here or the request never leaves the browser.
Access-Control-Max-Age (response)
How long a preflight result may be cached. Browsers cap it well below what you set — Chrome at 2 hours.
Origin (request)
Where the request came from, sent on cross-origin requests and all POSTs. What a CORS check and a CSRF check both look at.
Accept (request)
What the client can take back, as media types with quality values. Content negotiation happens here, and Vary has to name it if you use it.
Accept-Encoding (request)
Which compressions the client understands. Respond compressed only with one of these, and add Vary: Accept-Encoding.
Accept-Language (request)
Preferred languages with weights. A hint, not an instruction — and a poor way to pick a locale on its own, because it reflects the browser install and not the reader.
User-Agent (request)
The client naming itself, in a string that has been a fiction since roughly 1996. Feature-detect instead; it is frozen or reduced in modern browsers anyway.
Range (request)
Ask for part of the body — bytes=0-1023. What makes seeking in a video and resuming a download possible; the server answers 206 with Content-Range.
Retry-After (response)
Sent with 429 or 503 to say when to come back, in seconds or as a date. Answering 429 without it leaves the client guessing, and it will guess badly.
Location (response)
Where to go, with a 3xx, or where the thing just created lives, with a 201.
Link (response)
Relationships as a header rather than in the markup — rel=preload, rel=canonical, pagination. Read before the body arrives, which is the point.
X-Forwarded-For (request)
The client address as a proxy saw it. Trivially forged unless every hop is yours, so never use it for anything that matters without knowing your proxy chain.
Forwarded (request)
The standard version of the X-Forwarded-* family, carrying for, proto and host in one. Less widely implemented, better specified.
Server-Timing (response)
Timings from the server, shown in the browser devtools next to the network timings. Costs nothing and answers "is it us or the network".
Idempotency-Key (request)
A client-chosen key so that retrying a POST does not charge the card twice. Not a standard header, and universal anyway in payment APIs.파일은 내 기기 밖으로 나가지 않습니다
이 도구는 브라우저 안에서만 작동합니다. 붙여넣은 내용은 기기에서 처리되고 서버로 전송되지 않으므로 토큰, 키, 공개 전 문서도 안심하고 사용할 수 있습니다.
사용 방법
- 비워 두면 전체가 나옵니다.
- 헤더 이름을 넣으면 그 하나가 나옵니다.
- “cors”, “cache”, “cookie” 같은 단어로 묶어서 찾을 수 있습니다.
- 방향을 좁히려면 요청/응답을 고릅니다.
자주 묻는 질문
- no-cache는 “캐시하지 마라”인가요?
- 아닙니다. HTTP에서 가장 많이 잘못 읽히는 값입니다. no-cache는 “저장해도 되지만 재사용 전에 반드시 검증하라”는 뜻입니다. 저장 자체를 막는 것은 no-store입니다. 이 둘을 바꿔 쓰면 사적인 데이터를 캐시에 흘리거나 캐시 적중률을 망치게 됩니다.
- CORS가 안 됩니다.
- 대개 자격 증명 규칙입니다. credentials를 허용하면 Access-Control-Allow-Origin에 *를 쓸 수 없고 정확한 오리진을 적어야 합니다. 다음으로 흔한 것은 커스텀 요청 헤더를 Access-Control-Allow-Headers에 나열하지 않은 경우로, 이때 요청은 브라우저를 떠나기도 전에 실패합니다.
- 보안 헤더는 어떤 걸 넣어야 하나요?
- 효과가 가장 크고 손도 가장 많이 가는 것이 Content-Security-Policy입니다. X-Content-Type-Options: nosniff는 값 하나에 부작용이 없습니다. Strict-Transport-Security는 강력하고 되돌리기 어려우니 짧은 max-age부터 시작하세요. Referrer-Policy는 비용 없이 URL 유출을 막아 줍니다.
- 왜 전체 목록이 아닌가요?
- 전체를 실으면 동작을 정하는 게 아니라 설명만 하는 헤더가 대부분을 차지하기 때문입니다. 그런 것 마흔 개를 지나쳐야 원하는 것에 닿는 목록은 레퍼런스 구실을 못 합니다.
- 서버로 전송되나요?
- 아니요. 브라우저 안에서만 동작하므로 입력한 내용은 컴퓨터를 벗어나지 않습니다.