HTTP 압축

yoeubi
1 min readAug 22, 2020

--

출처: https://developer.mozilla.org/ko/docs/Web/HTTP/Compression

리소스 다운받을때 사이즈가 크면 웹페이지가 뜨는 시간도 같이 길어집니다.

리소스 크기를 줄이는 방법중 하나가 바로 텍스트 압축이다.

모든 브라우저와 서버는 텍스트 압축을 지원합니다.

브라우저는 Accept-Encoding 헤더를 사용해서 클라이언트가 이해 가능한 컨텐츠 인코딩이 무엇인지 알려줍니다.

이때 주로 gzip, deflate 압축 포맷을 사용한다고 전달합니다.

서버는 헤더를 뽑아내서 바디를 압축하는데 사용하고 서버가 선택한 알고리즘을 Content-Encoding 헤더에 담아 브라우저에 알려줍니다.

주의점

HTTP 압축을 사용하면 서버에서 압축한 다음 클라이언트에서 해제를 해야하는데 이때 브라우저 자원이 소모가 되기때문에 모든 파일에 대해서 압축하면 오히려 성능이 떨어질 수 있다.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

yoeubi
yoeubi

Written by yoeubi

Junior Frontend engineer

No responses yet

Write a response