개발관련 도서/Http&Network Basic

6장 HTTP 헤더

prden 2021. 7. 14. 09:42

1. 메시지 헤더 : 

HTTP 프로토콜의 리퀘스트와 리스폰스에는 반드시 메시지 헤더가 포함되어 있다.

메시지 헤더에는 클라이언트나 서버가 리퀘스트 리스폰스를 처리하기 위한 정보가 들어있다. 

그리고 메시지 바디의 크기나 사용하고 있는 언어, 인증 정보 등을 브라우저나 서버에 제공하기 위해 사용된다. 

예를 들어 Content-Type:text/html이라는  메시지 바디의 오브젝트 타입을 가리키는 헤더 필드가 있다. 

 

2. Keep-Alive에 관하여

Http는 state less이며 connection less이다. 따라서 데이터를 주고받을 때마다 열고 닫고를 반복하는데

Keep-Alive를 설정하면 데이터를 지정한 시간 내지정한 횟수 내에서 데이터를 빈번하게 주고받을 수 있다.

 

1) Keep-Alive의 defalut는 On상태이고 

2) timeout 이란 Keep-Alive를 유지하는 시간을 말하고

3) max란 Keep-Alive의 횟수제한을 말한다. 

 

* 예를 들어 Keep-Alive timeout=5, max=99일 경우 5초 안에 99번 내에서 요청을 할 수 있다는 것이다.

3. General 

1) Remote Address:

https://stackoverflow.com/questions/3812166/difference-between-remote-host-and-remote-addr

 

Difference between REMOTE_HOST and REMOTE_ADDR

What is the difference between these two variables? REMOTE_HOST and REMOTE_ADDR.

stackoverflow.com

2) Referrer Policy : 

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy

 

Referrer-Policy - HTTP | MDN

The Referrer-Policy HTTP header controls how much referrer information (sent with the Referer header) should be included with requests. Aside from the HTTP header, you can set this policy in HTML.

developer.mozilla.org

3) referer header : privacy and security concerns (https://developer.mozilla.org/en-US/docs/Web/Security/Referer_header:_privacy_and_security_concerns)

 

 a. referrer problem : 

The Refere header contains the address of a request (for example, the address of the previous web page from which a link to the currently requested page was followed, or the address of a page loading an image or other resource). 이러한 2가지 정보가 정보 탈취되고, 개인정보 같은 것 유출될 수 있다.(이전에 봤던 정보가 다른 사이트 링크 타고 넘어가거나 할 때 이전에 본 정보(Referrer header에 담겨서) -

 

 b. 이를 해결하기 위한 방법 : 

Much of this risk can be mitigated by sensible design of applications. A sensible application would remove such risks by making single-use password reset URLs, or combining them with a unique user token. The risk can also be reduced by transmitting sensitive data in more secure ways.

post method 사용, HTTPS사용(HTTPS sites will never transmit referrer information to non-HTTPS sites.)

 

4)

a. no-referrer : The Referer header will be omitted: sent requests do not include any referrer information.

b. no-referrer-when-downgrade :

Send the origin, path, and querystring in Referer when the protocol security level stays the same or improves (HTTP→HTTP, HTTP→HTTPS, HTTPS→HTTPS). Don't send the Referer header for requests to less secure destinations (HTTPS→HTTP, HTTPS→file).

c. strict-origin-when-cross-origin (default):

Send the origin, path, and querystring when performing a same-origin request. For cross-origin requests send the origin (only) when the protocol security level stays same (HTTPS→HTTPS). Don't send the Referer header to less secure destinations (HTTPS→HTTP).

4. Response Headers

5. Request Headers

1) accept : 

https://developer.mozilla.org/ko/docs/Web/HTTP/Headers/Accept

 

Accept - HTTP | MDN

Accept 요청 HTTP 헤더는 MIME 타입으로 표현되는, 클라이언트가 이해 가능한 컨텐츠 타입이 무엇인지를 알려줍니다. 컨텐츠 협상을 이용해, 서버는 제안 중 하나를 선택하고 사용하며 Content-Type

developer.mozilla.org

2) MIME types :

A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in 

IETF's RFC 6838

 

https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types

 

MIME types (IANA media types) - HTTP | MDN

A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

developer.mozilla.org

3) userAgent : 

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

 

User-Agent - HTTP | MDN

The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent.

developer.mozilla.org

 

*CORS 번외, https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

 

Cross-Origin Resource Sharing (CORS) - HTTP | MDN

Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. CORS also relies on a mechanism by which

developer.mozilla.org