본문 바로가기
카테고리 없음

자주 사용하는 HTTP 헤더

by 잘먹는 개발자 에단 2025. 4. 10.

** 요청헤더

1. Accept

- 클라이언트가 이해하거나 처리할 수 있는 응답 데이터 타입을 지정

- ex) Accept : application/json

 

2. Accept-Encoding

- 클라이언트가 지원하는 콘텐츠 압축방식을 명시

- Accept-Encoding : gzip, deflate

 

3. Accept-Language

- 클라이언트가 선호하는 언어를 나타냄

- Accept-Language : en-US, ko

 

4. Content-Type

- 요청 본문의 데이터 타입 명시

- Content-Type : application/json

 

5. Authorization

- 인증 토큰이나 자격증명 포함

- Authorization : Bearer <token>

 

6. User-Agent

- 클라이언트 어플리케이션 ( 브라우저 등 )의 정보를 제공한다.

- user-Agent : Mozilla/5.0 ....

 

7. Cookie

- 클라이언트가 저장한 쿠키들을 서버에 전달한다.

- Cookie : sessionId=abc123; theme=dark

 

 

 

* 응답헤더

1. Content-Type

- 응답 본문에 포함도니 데이터의 타입을 지정한다.

- Content-Type : application/json

 

2. Content-Length

- 응답 본문의 바이트 크기를 명시

- Content-Length : 1234

 

3. Cache-Control

- 캐시 정책을 제어하는 헤더

- Cache-Control : no-cache, no-store, must-revalidate

 

4. Set-Cookie

- 서버가 클라이언트에게 쿠키를 설정하도록 지시

- Set-Cookie : sessionId=abc123; HttpOnly; Secure

 

5. Content-Encoding

- 응답 본문에 적용된 압축 방식을 명시

- Content-Encoding : gzip