<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – HTTP</title>
    <link>https://www.devkuma.com/en/tags/http/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/http/logo/180x180.jpg</url>
      <title>HTTP</title>
      <link>https://www.devkuma.com/en/tags/http/</link>
    </image>
    <description>Recent content in HTTP on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/http/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Introduction to HTTP</title>
      <link>https://www.devkuma.com/en/docs/http/overview/</link>
      <pubDate>Tue, 06 Nov 2018 01:34:33 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/overview/</guid>
      <description>
        
        
        &lt;h2 id=&#34;http-overview&#34;&gt;HTTP Overview&lt;/h2&gt;
&lt;p&gt;HTTP (HyperText Transfer Protocol) is a protocol for sending and receiving data, such as web pages, between web servers and clients (browsers) on the WWW.
It basically exchanges text message resources, and it can also exchange various other resources such as &lt;code&gt;.jpeg&lt;/code&gt; files.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP is an application-level protocol built on TCP/IP.&lt;/li&gt;
&lt;li&gt;HTTP is a stateless protocol that does not maintain state.&lt;/li&gt;
&lt;li&gt;It consists of Method, Path, Version, Headers, Body, and similar parts.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following specifications are published for each HTTP version.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://www.ietf.org/rfc/rfc1945.txt&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC1945 (HTTP/1.0)&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.ietf.org/rfc/rfc2616.txt&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC2616 (HTTP/1.1)&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.ietf.org/rfc/rfc7540.txt&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC7540 (HTTP/2)&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;http-messages&#34;&gt;HTTP Messages&lt;/h2&gt;
&lt;p&gt;There are two types of HTTP messages.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP request message: the client requests a resource from the server.&lt;/li&gt;
&lt;li&gt;HTTP response message: the server responds to the client with the result of the HTTP request.&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>HTTP</category>
      
    </item>
    
    <item>
      <title>HTTP Request</title>
      <link>https://www.devkuma.com/en/docs/http/request/</link>
      <pubDate>Tue, 06 Nov 2018 01:34:33 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/request/</guid>
      <description>
        
        
        &lt;h2 id=&#34;http-request-messages&#34;&gt;HTTP Request Messages&lt;/h2&gt;
&lt;p&gt;When a web page is opened in a browser, the browser sends a request message like the following to the server.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-http&#34; data-lang=&#34;http&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;GET&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;/&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;HTTP&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1.1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Accept&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;image/gif, image/jpeg, */*&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Accept-Language&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;ko&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Accept-Encoding&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;gzip, deflate&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;User-Agent&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Mozilla/4.0 (Compatible; MSIE 6.0; Windows NT 5.1;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Host&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;www.xxx.zzz&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Connection&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Keep-Alive&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A request message consists of the following syntax.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;HTTP request line&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;GET / HTTP/1.1
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;HTTP request header&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Accept: image/gif, image/jpeg, */*
Accept-Language: ko
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (Compatible; MSIE 6.0; Windows NT 5.1;)
Host: www.xxx.zzz
Connection: Keep-Alive
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;HTTP body&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Message body (used with methods such as POST)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;start-line&#34;&gt;Start Line&lt;/h2&gt;
&lt;p&gt;The start line of an HTTP request has the following three elements.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP method&lt;/li&gt;
&lt;li&gt;Request target (path name)&lt;/li&gt;
&lt;li&gt;HTTP protocol version&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The request line is displayed in the following format.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Request line&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[HTTP method] [request target] [HTTP protocol version]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The path name is usually like &lt;code&gt;/aaa/bbb/ccc.html&lt;/code&gt;, and either a path name starting with a slash or a URL starting with &lt;code&gt;http://&lt;/code&gt; is specified. Version 1.1 is commonly used.&lt;/p&gt;
&lt;h3 id=&#34;http-method&#34;&gt;HTTP Method&lt;/h3&gt;
&lt;p&gt;The methods supported by HTTP/1.0 and HTTP/1.1 are as follows.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Method&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;HTTP/1.0&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;HTTP/1.1&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;GET&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;◎&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;◎&lt;/td&gt;
          &lt;td&gt;The most commonly used method. The browser asks the server to retrieve a page.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;HEAD&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;◎&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;◎&lt;/td&gt;
          &lt;td&gt;Requests header-only information. Servers must support GET and HEAD.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;POST&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Used to send data entered in a form with &lt;code&gt;method=&amp;quot;POST&amp;quot;&lt;/code&gt; to the server.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;PUT&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Used to upload a file to the server.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;DELETE&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Requests that the server delete the specified resource.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;CONNECT&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;×&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Used for SSL communication through a proxy server.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;OPTIONS&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;×&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Used to query the methods and options supported by the server.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;TRACE&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;×&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Used to trace HTTP behavior, such as which proxy servers an HTTP request passes through. The final server that receives this message returns the entity contained in the request message, usually headers plus message body, as-is.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;LINK&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;×&lt;/td&gt;
          &lt;td&gt;Creates a link relationship between the specified URL and resource. No longer used in HTTP/1.1.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;UNLINK&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;×&lt;/td&gt;
          &lt;td&gt;Removes the link relationship between the specified URL and resource. No longer used in HTTP/1.1.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;(◎: required, ○: supported, ×: not supported)&lt;/p&gt;
&lt;p&gt;Apache also supports methods such as PATCH, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, and UNLOCK.&lt;/p&gt;
&lt;h4 id=&#34;get&#34;&gt;GET&lt;/h4&gt;
&lt;p&gt;The GET request method asks the server to retrieve information held by a URI (URL).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Transmission format&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;GET [request-uri]?query_string  
HTTP/1.1\r\n  
Host: [Hostname] or [IP] \r\n   
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;post&#34;&gt;POST&lt;/h4&gt;
&lt;p&gt;The POST request method is used when form input is processed by a server-side script such as ASP, PHP, JSP, or a CGI program configured for the request URI (URL). It is sent together with the form action, and the request information is placed in the data part rather than in the header.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Transmission format&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;POST [request-uri]?query_string  
HTTP/1.1\r\n  
HOST:[Hostname] or [IP] \r\n  
Content-Length:[Length in Bytes] \r\n  
\r\n  
[query-string] or [data]
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;head&#34;&gt;HEAD&lt;/h4&gt;
&lt;p&gt;The HEAD request method is similar to GET, but the web server sends no data other than header information.&lt;br&gt;
It can be used to check whether a web server is down (health check) or to obtain web server information such as its version.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Transmission format&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;HEAD [request-uri] HTTP/1.1\r\n  
Host: [Hostname] or [IP] \r\n 
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;options&#34;&gt;OPTIONS&lt;/h4&gt;
&lt;p&gt;&lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc2616#section-9.2&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;rfc2616&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;br&gt;
This method can be used to check which methods are supported by the system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Transmission format&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;OPTIONS [request-ri]  
HTTP/1.1\r\n  
Host: [Hostname] or [IP] \r\n 
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;put&#34;&gt;PUT&lt;/h4&gt;
&lt;p&gt;Because it has a transmission structure similar to POST, a message (data) is sent together with headers.&lt;br&gt;
It is used to store specified content on a remote server and is often abused for website defacement.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Transmission format&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PUT [request-uri] HTTP/1.1\r\n  
Host: [Hostname] or [IP] \r\n  
Content-Length:[Length in Bytes] \r\n  
Content-Type:[Content Type] \r\n  
\r\n  
[data] 
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;patch&#34;&gt;PATCH&lt;/h4&gt;
&lt;p&gt;PATCH is used to modify (UPDATE) the requested resource, similarly to PUT.&lt;br&gt;
PUT means updating the whole resource, while PATCH means replacing part of that resource. In other words, it partially changes a resource.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Transmission format&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PATCH [request-uri] HTTP/1.1\r\n  
Host: [Hostname] or [IP]\r\n  
Content-Length:[Length in Bytes]\r\n  
Content-Type:[Content Type]\r\n  
\r\n  
[data] 
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;delete&#34;&gt;DELETE&lt;/h4&gt;
&lt;p&gt;DELETE is used to delete a file on a remote web server and is the opposite concept of PUT.&lt;/p&gt;
&lt;h4 id=&#34;trace&#34;&gt;TRACE&lt;/h4&gt;
&lt;p&gt;TRACE is used to call a loopback message on a remote server.&lt;/p&gt;
&lt;h4 id=&#34;connect&#34;&gt;CONNECT&lt;/h4&gt;
&lt;p&gt;CONNECT is used to request proxy functionality from a web server.&lt;/p&gt;
&lt;h3 id=&#34;request-target&#34;&gt;Request Target&lt;/h3&gt;
&lt;p&gt;The request target includes URLs, paths, query strings, and similar values.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Request target form&lt;/th&gt;
          &lt;th&gt;Example&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;origin form&lt;/td&gt;
          &lt;td&gt;- POST / HTTP/1.1&lt;br&gt;- GET /background.png HTTP/1.0&lt;br&gt;- HEAD /test.html?query=alibaba HTTP/1.1&lt;br&gt;- OPTIONS /anypage.html HTTP/1.0&lt;/td&gt;
          &lt;td&gt;Common form&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;absolute form&lt;/td&gt;
          &lt;td&gt;GET &lt;a href=&#34;http://developer.mozilla.org/en-US/docs/Web/HTTP/Messages&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;http://developer.mozilla.org/en-US/docs/Web/HTTP/Messages&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; HTTP/1.1&lt;/td&gt;
          &lt;td&gt;Used when doing GET through a proxy&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;authority form&lt;/td&gt;
          &lt;td&gt;CONNECT developer.mozilla.org:80 HTTP/1.1&lt;/td&gt;
          &lt;td&gt;Used with CONNECT&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;asterisk form&lt;/td&gt;
          &lt;td&gt;OPTIONS * HTTP/1.1&lt;/td&gt;
          &lt;td&gt;Used with OPTIONS&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;http-protocol-version&#34;&gt;HTTP Protocol Version&lt;/h3&gt;
&lt;p&gt;Indicates the HTTP version. Usually HTTP/1.1 or 2.0.&lt;/p&gt;
&lt;h2 id=&#34;http-header&#34;&gt;HTTP Header&lt;/h2&gt;
&lt;p&gt;There are three types of request headers.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Header type&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
          &lt;th&gt;Examples&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Request header&lt;/td&gt;
          &lt;td&gt;Headers not related to the data in the request body&lt;/td&gt;
          &lt;td&gt;- Host&lt;br&gt;- User-Agent&lt;br&gt;- Accept -&lt;em&gt;&lt;br&gt;- If-&lt;/em&gt;&lt;br&gt;- Referer&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;General header&lt;/td&gt;
          &lt;td&gt;Resource to retrieve&lt;/td&gt;
          &lt;td&gt;- Date&lt;br&gt;- Cache-Control&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Entity header&lt;/td&gt;
          &lt;td&gt;Applies to the request body&lt;/td&gt;
          &lt;td&gt;- Content-Type&lt;br&gt;- Content-Length&lt;br&gt;- Expires&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;http-body&#34;&gt;HTTP Body&lt;/h2&gt;
&lt;p&gt;The HTTP request body is the data sent with the request.&lt;br&gt;
In general, &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;HEAD&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;, and &lt;code&gt;OPTIONS&lt;/code&gt; do not have request bodies. They are used only when retrieving or deleting resources.&lt;br&gt;
The request body is used when sending data to a resource with POST, PUT, and similar methods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Checking a request body&lt;/strong&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;% curl --trace-ascii - http://www.devkuma.com/ -XPOST -d &amp;#39;user=kimkc,password=1234&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; Send data, 24 bytes (0x18)
0000: user=kimkc,password=1234
&lt;/code&gt;&lt;/pre&gt;
      </description>
      
      <category>HTTP</category>
      
    </item>
    
    <item>
      <title>HTTP Response</title>
      <link>https://www.devkuma.com/en/docs/http/response/</link>
      <pubDate>Tue, 06 Nov 2018 01:34:33 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/response/</guid>
      <description>
        
        
        &lt;h2 id=&#34;http-response-messages&#34;&gt;HTTP Response Messages&lt;/h2&gt;
&lt;p&gt;When a request arrives, the server returns a response message like the following.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-http&#34; data-lang=&#34;http&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;HTTP&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;1.1&lt;/span&gt; &lt;span style=&#34;color:#0000cf;font-weight:bold&#34;&gt;200&lt;/span&gt; &lt;span style=&#34;color:#c00;font-weight:bold&#34;&gt;OK&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Date&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Sun, 11 Jan 2014 16:06:23 GMT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Server&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Apache/1.3.22 (Unix) (Red-Hat/Linux)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Last-Modified&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Sun, 07 Dec 2013 12:34:18 GMT&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;ETag&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;&amp;#34;1dba6-131b-3fd31e4a&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Accept-Ranges&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;bytes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Content-Length&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;4891&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Keep-Alive&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;timeout=15, max=100&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Connection&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;Keep-Alive&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;Content-Type&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;text/html&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#8f5902;font-style:italic&#34;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;html&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  :
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;html&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A response message consists of a response line (status line), HTTP response headers, a blank line that marks the end of headers, and an HTTP body.&lt;/p&gt;
&lt;p&gt;Line breaks use the Windows-style &lt;code&gt;CR LF(&amp;quot;\r\n&amp;quot;)&lt;/code&gt;. The first line is the request or response line, headers can span multiple lines, the blank line is one line, and the message body can span multiple lines.&lt;/p&gt;
&lt;h2 id=&#34;start-line&#34;&gt;Start Line&lt;/h2&gt;
&lt;p&gt;The start line (status line) of an HTTP response has the following three elements.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP protocol version, the same as an HTTP request message&lt;/li&gt;
&lt;li&gt;Response status code&lt;/li&gt;
&lt;li&gt;Status text&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The response start line is displayed in the following format.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;[HTTP protocol version] [response status code] [status text]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The status text returns a message that supplements the meaning and details of a status number, such as OK or Not Found.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;% curl http://google.com/ --head
HTTP/1.1 301 Moved Permanently
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;HTTP protocol version: HTTP/1.1&lt;/li&gt;
&lt;li&gt;Response status code: 301&lt;/li&gt;
&lt;li&gt;Status text: Moved Permanently&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;http-protocol-version&#34;&gt;HTTP Protocol Version&lt;/h3&gt;
&lt;p&gt;Indicates the HTTP version, the same as an HTTP request message. Usually HTTP/1.1 or 2.0.&lt;/p&gt;
&lt;h3 id=&#34;response-status-code-and-status-text&#34;&gt;Response Status Code and Status Text&lt;/h3&gt;
&lt;p&gt;HTTP/1.1 status code definitions are specified in &lt;a href=&#34;https://datatracker.ietf.org/doc/html/rfc2616&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC 2616&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;. In summary:&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Response code&lt;/th&gt;
          &lt;th&gt;Meaning&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;1xx&lt;/td&gt;
          &lt;td&gt;Informational&lt;/td&gt;
          &lt;td&gt;Information&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;2xx&lt;/td&gt;
          &lt;td&gt;Successful&lt;/td&gt;
          &lt;td&gt;Successful response&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;3xx&lt;/td&gt;
          &lt;td&gt;Redirection&lt;/td&gt;
          &lt;td&gt;Additional action (redirection)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;4xx&lt;/td&gt;
          &lt;td&gt;Client Error&lt;/td&gt;
          &lt;td&gt;Client-side error&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;5xx&lt;/td&gt;
          &lt;td&gt;Server Error&lt;/td&gt;
          &lt;td&gt;Server-side error&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;1xx, 2xx, and 3xx codes indicate states between the server and user agent, so general users usually do not see their contents. 4xx and 5xx codes are commonly seen by general users.&lt;/p&gt;
&lt;p&gt;If a web page does not appear normally in a browser for any reason, it corresponds to a 3xx or 4xx error. To understand and recover from the cause of an error, it is useful to know roughly what the error code means.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Response code&lt;/th&gt;
          &lt;th&gt;Meaning&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;100&lt;/td&gt;
          &lt;td&gt;Continue&lt;/td&gt;
          &lt;td&gt;The server has received part of the request and asks the client to continue sending the rest.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;101&lt;/td&gt;
          &lt;td&gt;Switching protocols&lt;/td&gt;
          &lt;td&gt;Protocol switching. The requester asked the server to switch protocols, and the server is approving it.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;200&lt;/td&gt;
          &lt;td&gt;OK&lt;/td&gt;
          &lt;td&gt;The request was successfully performed.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;201&lt;/td&gt;
          &lt;td&gt;Created&lt;/td&gt;
          &lt;td&gt;The request succeeded, and the server created a new resource.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;202&lt;/td&gt;
          &lt;td&gt;Accepted&lt;/td&gt;
          &lt;td&gt;The web server accepted the request but has not processed it yet.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;203&lt;/td&gt;
          &lt;td&gt;Non-authoritative information&lt;/td&gt;
          &lt;td&gt;The server successfully processed the request but is providing information received from another source.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;204&lt;/td&gt;
          &lt;td&gt;No content&lt;/td&gt;
          &lt;td&gt;The server successfully processed the request but provides no content.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;205&lt;/td&gt;
          &lt;td&gt;Reset Content&lt;/td&gt;
          &lt;td&gt;The server successfully processed the request but provides no content.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;206&lt;/td&gt;
          &lt;td&gt;Partial content&lt;/td&gt;
          &lt;td&gt;The server successfully processed part of a GET request.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;300&lt;/td&gt;
          &lt;td&gt;Multiple Choices&lt;/td&gt;
          &lt;td&gt;Several options exist for obtaining the content.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;301&lt;/td&gt;
          &lt;td&gt;Moved permanently&lt;/td&gt;
          &lt;td&gt;The requested data has moved to another URL.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;302&lt;/td&gt;
          &lt;td&gt;Found temporarily&lt;/td&gt;
          &lt;td&gt;The requested data was found at a temporary URL.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;304&lt;/td&gt;
          &lt;td&gt;Not modified&lt;/td&gt;
          &lt;td&gt;The resource was not updated, so local cache information was used.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;305&lt;/td&gt;
          &lt;td&gt;Use Proxy&lt;/td&gt;
          &lt;td&gt;Uses the proxy specified in the Location header.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;306&lt;/td&gt;
          &lt;td&gt;(Unused)&lt;/td&gt;
          &lt;td&gt;Unused.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;307&lt;/td&gt;
          &lt;td&gt;Temporary Redirect&lt;/td&gt;
          &lt;td&gt;Temporarily moving to another location.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;400&lt;/td&gt;
          &lt;td&gt;Bad request&lt;/td&gt;
          &lt;td&gt;The request is invalid. The user&amp;rsquo;s invalid request cannot be processed.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;401&lt;/td&gt;
          &lt;td&gt;Unauthorized&lt;/td&gt;
          &lt;td&gt;Not authenticated. Occurs when requesting a page that requires authentication.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;402&lt;/td&gt;
          &lt;td&gt;Payment required&lt;/td&gt;
          &lt;td&gt;Reserved. Payment is required.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;403&lt;/td&gt;
          &lt;td&gt;Forbidden&lt;/td&gt;
          &lt;td&gt;Access is not allowed.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;404&lt;/td&gt;
          &lt;td&gt;Not found&lt;/td&gt;
          &lt;td&gt;The requested page does not exist.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;405&lt;/td&gt;
          &lt;td&gt;Method not allowed&lt;/td&gt;
          &lt;td&gt;An unsupported HTTP method was used.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;407&lt;/td&gt;
          &lt;td&gt;Proxy authentication required&lt;/td&gt;
          &lt;td&gt;Proxy authentication is required.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;408&lt;/td&gt;
          &lt;td&gt;Request timeout&lt;/td&gt;
          &lt;td&gt;The request timed out.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;410&lt;/td&gt;
          &lt;td&gt;Gone&lt;/td&gt;
          &lt;td&gt;Permanently unavailable. The requested content has disappeared.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;411&lt;/td&gt;
          &lt;td&gt;Length Required&lt;/td&gt;
          &lt;td&gt;Add a Content-Length header to the request.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;412&lt;/td&gt;
          &lt;td&gt;Precondition failed&lt;/td&gt;
          &lt;td&gt;The condition specified in an If-* header was not met.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;414&lt;/td&gt;
          &lt;td&gt;Request-URI too long&lt;/td&gt;
          &lt;td&gt;The request URL is too long.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;415&lt;/td&gt;
          &lt;td&gt;Unsupported Media Type&lt;/td&gt;
          &lt;td&gt;The media type is not supported.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;416&lt;/td&gt;
          &lt;td&gt;Requested Range Not Satisfiable&lt;/td&gt;
          &lt;td&gt;The requested range is invalid.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;417&lt;/td&gt;
          &lt;td&gt;Expectation Failed&lt;/td&gt;
          &lt;td&gt;The extension request specified in the Expect header failed.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;500&lt;/td&gt;
          &lt;td&gt;Internal server error&lt;/td&gt;
          &lt;td&gt;An unexpected server error occurred.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;501&lt;/td&gt;
          &lt;td&gt;Not implemented&lt;/td&gt;
          &lt;td&gt;The web server cannot process the request.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;502&lt;/td&gt;
          &lt;td&gt;Bad Gateway&lt;/td&gt;
          &lt;td&gt;The gateway is invalid.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;503&lt;/td&gt;
          &lt;td&gt;Service unavailable&lt;/td&gt;
          &lt;td&gt;Service unavailable.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;504&lt;/td&gt;
          &lt;td&gt;Gateway timeout&lt;/td&gt;
          &lt;td&gt;The gateway timed out.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;505&lt;/td&gt;
          &lt;td&gt;HTTP version not supported&lt;/td&gt;
          &lt;td&gt;The HTTP version is not supported.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;http-header&#34;&gt;HTTP Header&lt;/h2&gt;
&lt;p&gt;Response headers have the following three types.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Header type&lt;/th&gt;
          &lt;th&gt;Description&lt;/th&gt;
          &lt;th&gt;Examples&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Response header&lt;/td&gt;
          &lt;td&gt;Header not related to response body data&lt;/td&gt;
          &lt;td&gt;- Location&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;General header&lt;/td&gt;
          &lt;td&gt;Resource to retrieve&lt;/td&gt;
          &lt;td&gt;- Date&lt;br&gt;- Cache-Control&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Entity header&lt;/td&gt;
          &lt;td&gt;Applies to the response body&lt;/td&gt;
          &lt;td&gt;- Content-Type&lt;br&gt;- Content-Length&lt;br&gt;- Expires&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h2 id=&#34;http-body&#34;&gt;HTTP Body&lt;/h2&gt;
&lt;p&gt;Contains the contents of the resource (file).&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;% curl http://www.devkuma.com
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;!DOCTYPE html&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;html &lt;span style=&#34;color:#000&#34;&gt;lang&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;ko&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&amp;lt;head&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>HTTP</category>
      
    </item>
    
    <item>
      <title>HTTP Header</title>
      <link>https://www.devkuma.com/en/docs/http/header/</link>
      <pubDate>Tue, 06 Nov 2018 01:34:33 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/header/</guid>
      <description>
        
        
        &lt;h2 id=&#34;http-header&#34;&gt;HTTP Header&lt;/h2&gt;
&lt;p&gt;HTTP headers are metadata exchanged in HTTP requests and responses. They describe how the message should be interpreted, how caching should work, what content types are acceptable, authentication information, connection behavior, and entity information such as content length and encoding.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Category&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Request&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;Response&lt;/th&gt;
          &lt;th&gt;Headers&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;General header&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Cache-Control, Connection, Date, Pragma, Trailer, Transfer-Encoding, Upgrade, Via, Warning&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Request header&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;×&lt;/td&gt;
          &lt;td&gt;Accept, Accept-Charset, Accept-Encoding, Accept-Language, Authorization, Expect, From, Host, If-Match,&lt;br&gt;If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since, Max Forwards, Proxy-Authorization, Range,&lt;br&gt;Referer, TE, User-Agent&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Response header&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;×&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Accept-Ranges, Age, ETag, Location, Proxy-Authenticate, Retry-After, Server, Vary, WWW-Authenticate&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Entity header&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;○&lt;/td&gt;
          &lt;td&gt;Allow, Content-Encoding, Content-Language, Content-Length, Content-Location, Content-MD5, Content-Range,&lt;br&gt;Content-Type, Expires, Last-Modified, extension-header&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;common-request-headers&#34;&gt;Common Request Headers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Accept&lt;/code&gt;: tells the server which data formats (MIME types) the browser can receive. &lt;code&gt;*&lt;/code&gt; means &amp;ldquo;all.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Accept-Charset&lt;/code&gt;: tells the server which character sets the browser can receive.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Accept-Encoding&lt;/code&gt;: tells the server which encodings the browser can receive. For example, if gzip is supported, the server can gzip-compress the message body and the browser can decompress and display it.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Accept-Language&lt;/code&gt;: tells the server which languages the browser can receive.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Authorization&lt;/code&gt;: sends authentication information for a resource that requires authentication.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Host&lt;/code&gt;: specifies the host name and port number of the server to which the request is sent. It is the only required header in HTTP/1.1.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;If-Match&lt;/code&gt;, &lt;code&gt;If-None-Match&lt;/code&gt;, &lt;code&gt;If-Modified-Since&lt;/code&gt;, &lt;code&gt;If-Unmodified-Since&lt;/code&gt;, &lt;code&gt;If-Range&lt;/code&gt;: conditional request headers used with cache validation and partial requests.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Range&lt;/code&gt;: requests only part of an entity from the server.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Referer&lt;/code&gt;: passes the URL of the page that was the source of this request.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;User-Agent&lt;/code&gt;: sends information about the client application, browser, operating system, version, platform, and similar details.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;common-response-headers&#34;&gt;Common Response Headers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Accept-Ranges&lt;/code&gt;: tells the client which units are available for Range requests. Currently &lt;code&gt;bytes&lt;/code&gt; is defined.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Age&lt;/code&gt;: indicates the estimated elapsed time in seconds since the entity was generated.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ETag&lt;/code&gt;: indicates an identifier that uniquely identifies an entity and its version.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Location&lt;/code&gt;: indicates the redirect target URL.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Proxy-Authenticate&lt;/code&gt;: indicates that authentication is required between the proxy server and client.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Retry-After&lt;/code&gt;: returned with &lt;code&gt;503 Service Unavailable&lt;/code&gt; or 3xx redirection to indicate when to retry.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Server&lt;/code&gt;: returns server information to the browser.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Vary&lt;/code&gt;: indicates headers used for server-driven negotiation, such as &lt;code&gt;Accept&lt;/code&gt;, &lt;code&gt;Accept-Charset&lt;/code&gt;, and &lt;code&gt;Accept-Language&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WWW-Authenticate&lt;/code&gt;: indicates that authentication is required.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;common-entity-and-general-headers&#34;&gt;Common Entity and General Headers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Allow&lt;/code&gt;: provides the list of methods that can be used for the resource indicated by the request URL.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Cache-Control&lt;/code&gt;: indicates cache directives. In HTTP/1.0, &lt;code&gt;Pragma: no-cache&lt;/code&gt; is used.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Connection&lt;/code&gt;: indicates persistent connection behavior such as &lt;code&gt;Keep-Alive&lt;/code&gt; or &lt;code&gt;close&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Content-Encoding&lt;/code&gt;: indicates the content encoding method, such as gzip.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Content-Language&lt;/code&gt;: indicates the language of the content, such as &lt;code&gt;en&lt;/code&gt; or &lt;code&gt;ko&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Content-Length&lt;/code&gt;: indicates the length of the content (message body) in bytes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Content-Location&lt;/code&gt;: indicates another URL where the content is accessible.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Content-MD5&lt;/code&gt;: provides check data for verifying that content was not changed during communication.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Content-Range&lt;/code&gt;: indicates the range of content being sent.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Content-Type&lt;/code&gt;: indicates the MIME type of the resource, and can also include a character set.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Date&lt;/code&gt;: indicates the time at which the response is returned.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Expires&lt;/code&gt;: indicates the expiration date of the entity.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Last-Modified&lt;/code&gt;: indicates the time when the entity was last updated.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Max-Forwards&lt;/code&gt;: specifies the maximum number of forwarding or relay facilities to pass through for OPTIONS and TRACE.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Pragma&lt;/code&gt;: used for various purposes, such as telling proxies or clients not to use cache.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TE&lt;/code&gt;: tells the server which transfer codings or trailer fields the browser can process.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Trailer&lt;/code&gt;: lists headers appended after chunked content.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Transfer-Encoding&lt;/code&gt;: indicates the encoding format used for transfer.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Upgrade&lt;/code&gt;: tells the other party that another protocol is recommended.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Via&lt;/code&gt;: indicates the message delivery path through proxies.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Warning&lt;/code&gt;: passes warning codes and messages added to the status line.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;extension-header&lt;/code&gt;: various additional headers can be implemented by servers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;virtual-hosts&#34;&gt;Virtual Hosts&lt;/h2&gt;
&lt;p&gt;HTTP/1.1 supports virtual hosts. An HTTP/1.1 client must send the host name in the &lt;code&gt;Host&lt;/code&gt; header. The server responds with content corresponding to that virtual host. This makes it possible to support multiple websites on one server.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;GET / HTTP/1.1
Host: www.devkuma.com
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;persistent-connections-keep-alive&#34;&gt;Persistent Connections (Keep-Alive)&lt;/h2&gt;
&lt;p&gt;Early HTTP opened a new socket connection every time an HTTP request was sent, which was inefficient. Persistent connections solve this inefficiency by sending multiple requests over one connection. HTTP/1.0 introduced &lt;code&gt;Keep-Alive&lt;/code&gt;, which became standardized.&lt;/p&gt;
&lt;p&gt;Clients can improve communication performance by requesting multiple contents through a single TCP connection. When keeping a persistent connection, the &lt;code&gt;Connection&lt;/code&gt; header usually specifies &lt;code&gt;Keep-Alive&lt;/code&gt;; the final request specifies &lt;code&gt;close&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;chunked-transfer&#34;&gt;Chunked Transfer&lt;/h2&gt;
&lt;p&gt;When a server does not know the length of content, such as when generating CGI results, it can return chunked data. In chunked data, the byte count of continuous data is represented in hexadecimal. &lt;code&gt;0&lt;/code&gt; means the end of data.&lt;/p&gt;
&lt;h2 id=&#34;basic-authentication&#34;&gt;BASIC Authentication&lt;/h2&gt;
&lt;p&gt;With HTTP Basic authentication, the server returns the &lt;code&gt;WWW-Authenticate&lt;/code&gt; header in response to a client request. When the client receives it, it displays a dialog asking for a login name and password, encodes the entered values, and requests the content again.&lt;/p&gt;

      </description>
      
      <category>HTTP</category>
      
    </item>
    
    <item>
      <title>HTTP Cookie</title>
      <link>https://www.devkuma.com/en/docs/http/cookie/</link>
      <pubDate>Mon, 27 Dec 2021 18:02:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/cookie/</guid>
      <description>
        
        
        &lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;Cookies are used to implement features such as the following.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Record and display how many times a visitor has visited the page.&lt;/li&gt;
&lt;li&gt;Record a visitor&amp;rsquo;s recently visited page in a web service and show that page on the next visit.&lt;/li&gt;
&lt;li&gt;Record the username entered in a bulletin board or chat so the user can skip entering it next time.&lt;/li&gt;
&lt;li&gt;Maintain a login session.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following specifications are published.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc2109&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC2109&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; (February 1997)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc2965&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC2965&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; (October 2000)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tools.ietf.org/html/rfc6265&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC6265&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; (April 2011)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This kind of data can be recorded on the server side using CGI and similar mechanisms, but cookies can also record cookie information on the client-side hard disk, meaning the side where the browser runs.&lt;/p&gt;
&lt;h2 id=&#34;folder-and-file-where-cookie-information-is-stored&#34;&gt;Folder and File Where Cookie Information Is Stored&lt;/h2&gt;
&lt;p&gt;The file where cookie information is stored depends on the OS and browser version.&lt;/p&gt;
&lt;p&gt;For example, on Windows it may be recorded in folders or files such as:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;- C:\Document and Settings\(UserName)\Cookies
- C:\Program Files\Netscape\Users\(UserName]\cookies.txt
- C:\Program Files\Netscape\Navigator\cookies.txt
- C:\Windows\Cookies\~.txt
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For Chrome on macOS, it is stored under:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;- ~/Library/Application Support/Google/Chrome/Default/Cookies
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;writing-cookies&#34;&gt;Writing Cookies&lt;/h2&gt;
&lt;p&gt;When setting a cookie with JavaScript:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;document&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;cookie&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;~&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To specify it with HTML, use the following. This method is not recommended.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;meta&lt;/span&gt; &lt;span style=&#34;color:#c4a000&#34;&gt;http-equiv&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;Set-Cookie&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#c4a000&#34;&gt;content&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#34;~&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;~&lt;/code&gt; part specifies a string in the following format.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;NAME=value; expires=value; domain=value; path=value; secure
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Everything except &lt;code&gt;NAME=value;&lt;/code&gt; is optional.&lt;/p&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Parameter&lt;/th&gt;
          &lt;th&gt;Meaning&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;NAME=value&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the desired value for the desired name. Semicolons, commas, spaces, and Korean text must be encoded in an appropriate format. URL-style encodings such as &lt;code&gt;%3B&lt;/code&gt;, &lt;code&gt;%2C&lt;/code&gt;, and &lt;code&gt;%20&lt;/code&gt; are often used.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;expires=value&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the expiration date of the cookie recorded on the client side in a format such as &lt;code&gt;Thu, 1-Jan-2030 00:00:00 GMT&lt;/code&gt;. The time zone is always GMT. If omitted, it expires when the browser closes. If a past value is specified, the cookie is deleted.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;domain=value&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;Specifies the name of the web server that publishes the cookie. If omitted, it becomes the web server name, such as &lt;code&gt;www.devkuma.com&lt;/code&gt;.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;code&gt;path=value&lt;/code&gt;&lt;/td&gt;
          &lt;td&gt;When browsing a page matching this path name, the browser sends the stored cookie information to the server.&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;secure&lt;/td&gt;
          &lt;td&gt;If this variable is included, cookie information is sent only when the connection to the server is secure.&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;cookie-writing-example&#34;&gt;Cookie Writing Example&lt;/h3&gt;
&lt;p&gt;The simplest writing example is as follows. It is valid until the browser ends and is sent to pages in the same folder or lower layers as the page where it was set.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Set-Cookie: NAME=devkuma;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Specifying an expiration date:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Set-Cookie: NAME=devkuma; Tue, 31-Dec-2030 23:59:59;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;reading-cookies&#34;&gt;Reading Cookies&lt;/h2&gt;
&lt;p&gt;To read cookie values with JavaScript, refer to &lt;code&gt;document.cookie&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;alert&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87&#34;&gt;document&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;cookie&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
      
      <category>HTTP</category>
      
    </item>
    
    <item>
      <title>HTTPS</title>
      <link>https://www.devkuma.com/en/docs/http/https/</link>
      <pubDate>Thu, 18 Aug 2022 18:04:25 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/https/</guid>
      <description>
        
        
        &lt;h2 id=&#34;http-and-https&#34;&gt;HTTP and HTTPS&lt;/h2&gt;
&lt;h3 id=&#34;http&#34;&gt;HTTP&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;HTTP exchanges text, and HTML pages are also text.&lt;/li&gt;
&lt;li&gt;Because it sends and receives plain text rather than binary data, if someone intercepts signals on the network, the contents can be exposed. HTTPS was created to solve this security problem.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;https&#34;&gt;HTTPS&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;HTTPS is a communication protocol in which the client and server exchange data using the SSL (Secure Socket Layer) protocol, which encrypts information on the Internet.&lt;/li&gt;
&lt;li&gt;HTTPS encrypts HTTP text.&lt;/li&gt;
&lt;li&gt;The S in HTTPS means Secure Socket, a secure communication network.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;https-encryption-principle&#34;&gt;HTTPS Encryption Principle&lt;/h2&gt;
&lt;p&gt;The core principle of HTTP encryption is public key encryption.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Certificates are issued so that messages are encrypted with a public key.&lt;/li&gt;
&lt;li&gt;Because encrypted messages can only be decrypted with the private key, no one in the middle can obtain the original data.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;characteristics-of-https&#34;&gt;Characteristics of HTTPS&lt;/h2&gt;
&lt;p&gt;HTTPS implements HTTP on top of SSL/TLS.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/https-layer.jpeg&#34; alt=&#34;HTTP,HTTPS Layer&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Main functions&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Encryption&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Change detection and similar functions&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;URI Scheme prefix&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;https&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Port used&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If a URL has an &lt;code&gt;https&lt;/code&gt; URI scheme prefix instead of &lt;code&gt;http&lt;/code&gt;, it uses HTTPS port 443 rather than the usual HTTP port 80.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Standard&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.ietf.org/rfc/rfc2818.txt&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;RFC 2818&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;ssltls&#34;&gt;SSL/TLS&lt;/h3&gt;
&lt;p&gt;By using SSL (Secure Sockets Layer) or TLS (Transport Layer Security), which are encryption methods for HTTP communication, websites can be used safely.&lt;/p&gt;
&lt;p&gt;SSL and TLS are essentially the same. SSL was invented by Netscape. As it became widely used and later came under the management of the IETF standards organization, its name changed to TLS. TLS 1.0 succeeds SSL 3.0, but the name SSL is still used much more commonly.&lt;/p&gt;
&lt;h2 id=&#34;structure-for-securing-https&#34;&gt;Structure for Securing HTTPS&lt;/h2&gt;
&lt;p&gt;SSL/TLS secures websites through the following three mechanisms.&lt;/p&gt;
&lt;h3 id=&#34;preventing-eavesdropping-encrypted-communication&#34;&gt;Preventing Eavesdropping (Encrypted Communication)&lt;/h3&gt;
&lt;p&gt;Because website browsing passes through several servers, a third party can relatively easily intercept communication contents.&lt;br&gt;
Even if data is intercepted, encrypting it before transmission prevents third parties from reading it.&lt;/p&gt;
&lt;h3 id=&#34;preventing-tampering&#34;&gt;Preventing Tampering&lt;/h3&gt;
&lt;p&gt;Message digests are used as a countermeasure against data tampering, such as rewriting product quantities in online shopping.&lt;br&gt;
A message digest calculates a unique short value (hash value) from specific data. By comparing hash values when sending and receiving data, tampering can be detected.&lt;/p&gt;
&lt;h3 id=&#34;preventing-spoofing&#34;&gt;Preventing Spoofing&lt;/h3&gt;
&lt;p&gt;By placing an electronic certificate called an SSL server certificate on the web server and verifying it at connection time, the identity of the website operator can be confirmed.&lt;br&gt;
The certificate must be issued after authentication work by an approved certificate authority. If an untrusted certificate is used, a warning screen appears in the web browser.&lt;/p&gt;
&lt;h2 id=&#34;how-https-security-works&#34;&gt;How HTTPS Security Works&lt;/h2&gt;
&lt;p&gt;When a client (web browser) receives a URL with an &lt;code&gt;https&lt;/code&gt; scheme rather than plain &lt;code&gt;http&lt;/code&gt;, it opens a TCP connection to port 443 instead of port 80 on the web server and exchanges several security parameters in binary format (handshake, key exchange). Then the related HTTPS commands are executed.&lt;/p&gt;
&lt;h3 id=&#34;https-exchange&#34;&gt;HTTPS Exchange&lt;/h3&gt;
&lt;p&gt;To start HTTPS communication, four main phases are exchanged.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Decide the encryption method&lt;br&gt;
There are many encryption methods, so the web browser and web server must decide on an encryption method that both can use. The TLS version and message digest method are also decided at the same time.&lt;/li&gt;
&lt;li&gt;Prove the communication partner&lt;br&gt;
The browser checks with the SSL server certificate whether the web server is the correct target. If it cannot verify this, a warning is displayed.&lt;/li&gt;
&lt;li&gt;Key exchange&lt;br&gt;
The &amp;ldquo;key&amp;rdquo; used for data transmission is exchanged. The key is used for encryption during transmission and decryption during reading.&lt;/li&gt;
&lt;li&gt;Confirm the encryption method&lt;br&gt;
The final confirmation of the encryption method actually used is performed. When this step is complete, encrypted communication begins.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;These four stages in HTTPS are called the SSL/TLS handshake.&lt;/p&gt;
&lt;h2 id=&#34;https-server-certificate&#34;&gt;HTTPS Server Certificate&lt;/h2&gt;
&lt;p&gt;A server certificate is an electronic certificate issued by a certificate authority to perform encrypted communication between a server and client.&lt;/p&gt;
&lt;p&gt;It is based on X.509, and website information is added to the certificate.&lt;/p&gt;
&lt;h3 id=&#34;main-fields-included-in-a-server-certificate&#34;&gt;Main Fields Included in a Server Certificate&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Certificate serial number and validity period&lt;/li&gt;
&lt;li&gt;Website name&lt;/li&gt;
&lt;li&gt;Website DNS host name (FQDN)&lt;/li&gt;
&lt;li&gt;Website public key&lt;/li&gt;
&lt;li&gt;Name of the signing authority (certificate authority)&lt;/li&gt;
&lt;li&gt;Digital signature of the signing authority&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;main-certificate-checks-for-website-information&#34;&gt;Main Certificate Checks for Website Information&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Date check
&lt;ul&gt;
&lt;li&gt;Checks certificate validity period, expiration, activation, and similar status.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Signer validity check
&lt;ul&gt;
&lt;li&gt;Checks whether the certificate was derived from a valid certificate authority (chain of trust).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Signature check
&lt;ul&gt;
&lt;li&gt;Checks certificate integrity.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Site identity check
&lt;ul&gt;
&lt;li&gt;Checks whether the domain name specified in the certificate matches the actual domain name.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Virtual hosting check
&lt;ul&gt;
&lt;li&gt;When multiple sites or hosts are operated on one server, additional management and procedures are required.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://www.ktword.co.kr/test/view/view.php?m_temp1=3132&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HTTPS Secure Hypertext Transfer Protocol HTTP security layer implementation&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://opentutorials.org/course/228/4894&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HTTPS and SSL certificates | OpenTutorials&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>HTTP</category>
      
    </item>
    
    <item>
      <title>HTTP 2.0</title>
      <link>https://www.devkuma.com/en/docs/http/2_0/</link>
      <pubDate>Fri, 12 Aug 2022 07:47:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/2_0/</guid>
      <description>
        
        
        &lt;h2 id=&#34;http-20&#34;&gt;HTTP 2.0&lt;/h2&gt;
&lt;p&gt;HTTP/2, also called HTTP 2.0, stands for Hypertext Transfer Protocol Version 2. It is the next version of HTTP/1.1, the existing standard, and was officially published by the IETF in 2015.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;IETF: Internet Engineering Task Force&lt;/strong&gt; means the international Internet standards organization. It is an Internet standardization working group that discusses Internet operation, management, and development, and analyzes protocols and architectural issues.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;HTTP/2 operates on a TCP connection between the server and client. The client initializes this TCP connection. HTTP/2 requests and responses are contained in one or more frames with a defined length (maximum 16,383 bytes). Requests and responses in frames are sent through streams, and one stream handles a pair of request and response. Because multiple streams can be created simultaneously over one connection, multiple requests and responses can be processed at the same time. HTTP/2 also provides flow control and prioritization for streams. If the server thinks a resource is needed by the client, it can actively send it even without an explicit request.&lt;/p&gt;
&lt;h2 id=&#34;spdy&#34;&gt;SPDY&lt;/h2&gt;
&lt;p&gt;SPDY is a non-standard network protocol developed by Google. As the web environment continued to change, with more resources, many domains, dynamic web services, and the growing importance of security, it was designed to speed up HTTP by focusing on solving latency problems on the Internet based on packet compression and multiplexing. It was Google&amp;rsquo;s own protocol, built into early Chrome browsers, that provided high loading speed.&lt;/p&gt;
&lt;p&gt;HTTP/2 is based on SPDY and introduces a new binary layer below the HTTP protocol layer in the TCP communication layer, pursuing better efficiency for the TCP connections that HTTP depends on.&lt;/p&gt;
&lt;p&gt;SPDY showed significant performance improvements and efficiency compared with HTTP/1.1 and became a reference specification for the HTTP/2 draft.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/http-spdy-layer.png&#34; alt=&#34;SPDY&#34;&gt;&lt;/p&gt;
&lt;p&gt;SPDY&amp;rsquo;s characteristics include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Always operates on TLS
&lt;ul&gt;
&lt;li&gt;Applies only to websites written with HTTPS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;HTTP header compression
&lt;ul&gt;
&lt;li&gt;The more requests there are, the larger the compression ratio becomes, and the effect is large in mobile environments with low bandwidth.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Binary protocol rather than text
&lt;ul&gt;
&lt;li&gt;Parsing is faster and errors are less likely.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Multiplexing
&lt;ul&gt;
&lt;li&gt;Processes multiple independent streams simultaneously in one connection.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Full-duplex interleaving and prioritization
&lt;ul&gt;
&lt;li&gt;Allows other streams to interleave.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Server Push&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ultimately, SPDY can be seen as modifying HTTP&amp;rsquo;s data transfer format and connection management so TCP connections are used more efficiently. SPDY became a reference specification for HTTP/2, and most of these characteristics also exist in HTTP/2.&lt;/p&gt;
&lt;h2 id=&#34;main-characteristics&#34;&gt;Main Characteristics&lt;/h2&gt;
&lt;p&gt;The main characteristics aim to improve performance.&lt;/p&gt;
&lt;h3 id=&#34;packet-capsulation&#34;&gt;Packet Capsulation&lt;/h3&gt;
&lt;p&gt;As HTTP/2 packets are encapsulated into smaller units, the concepts of Frame, Message, and Stream are introduced.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/http-frame-stream-messages.png&#34; alt=&#34;Request multiplexing&#34;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Frame
&lt;ul&gt;
&lt;li&gt;The smallest communication unit in HTTP/2. Every packet includes one frame header.&lt;/li&gt;
&lt;li&gt;This frame header at least identifies the stream to which the frame belongs.&lt;/li&gt;
&lt;li&gt;HEADERS type frames and DATA type frames exist.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Message
&lt;ul&gt;
&lt;li&gt;The full sequence of frame data mapped to a logical request or response message.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Stream
&lt;ul&gt;
&lt;li&gt;The flow of a connection. It is a bidirectional flow of bytes delivered within an established connection, and one or more messages can be delivered.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All HTTP/2 connections are TCP-based streams and communicate messages with frame headers in both directions.&lt;/p&gt;
&lt;p&gt;Data is binary encoded, and multiplexing plus performance optimization algorithms are applied.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/http-stream.png&#34; alt=&#34;Request multiplexing&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;request-multiplexing&#34;&gt;Request Multiplexing&lt;/h3&gt;
&lt;p&gt;HTTP/2 can send and receive multiple data requests in parallel through one TCP connection.&lt;/p&gt;
&lt;p&gt;A stream is an independent bidirectional sequence of frames exchanged between client and server through an HTTP/2 connection. A pair of HTTP request and response is made through one stream. The client creates a new stream and sends an HTTP request; when the server responds on the same stream, that stream is closed.&lt;/p&gt;
&lt;p&gt;In HTTP/1.x, after sending a request over one TCP connection, another request could not be sent over the same TCP connection until the response arrived. In HTTP/2, multiple streams can be opened simultaneously in one connection, so multiple requests can be sent at the same time.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/http-request-multiplexing.png&#34; alt=&#34;Request multiplexing&#34;&gt;&lt;/p&gt;
&lt;p&gt;This reduces additional RTT (round-trip time), loads websites faster without extra optimization, and makes domain sharding unnecessary.&lt;/p&gt;
&lt;h3 id=&#34;header-compression&#34;&gt;Header Compression&lt;/h3&gt;
&lt;p&gt;In HTTP/1.1 and earlier, HTTP headers were sent without compression. Older web pages did not send as many requests as today, but modern web pages send countless requests, so header size affects both round-trip delay and bandwidth.&lt;/p&gt;
&lt;p&gt;HTTP/2 compresses HTTP message headers and avoids retransmitting duplicate fields.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP headers were plain text before, but HTTP/2 uses a header compression method called HPACK, which uses Huffman coding, to improve data transfer efficiency.&lt;/li&gt;
&lt;li&gt;Headers are split into &amp;ldquo;header block fragments,&amp;rdquo; sent, rejoined by the receiver, decompressed, and restored to the original header set.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Huffman coding&lt;/strong&gt; is an algorithm that uses codes of different lengths depending on the frequency of data characters.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/http-headder-data-compression.png&#34; alt=&#34;HTTP Header Data Compression&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;binary-protocol&#34;&gt;Binary Protocol&lt;/h3&gt;
&lt;p&gt;The latest HTTP version greatly improved functionality and properties by changing from a text protocol to a binary protocol. HTTP/1.x processed text commands to complete request-response cycles, while HTTP/2 uses binary commands (1 and 0) for the same work. This reduces frame-related complexity and simplifies implementation.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/http-binary-protocol.png&#34; alt=&#34;Binary protocol&#34;&gt;&lt;/p&gt;
&lt;h4 id=&#34;benefits-of-the-binary-protocol&#34;&gt;Benefits of the Binary Protocol&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Data parsing is faster and less error-prone.&lt;/li&gt;
&lt;li&gt;Network resources can be used more effectively.&lt;/li&gt;
&lt;li&gt;Network latency is reduced and throughput improves.&lt;/li&gt;
&lt;li&gt;Security issues related to text characteristics are addressed.&lt;/li&gt;
&lt;li&gt;Other HTTP/2 features such as compression, multiplexing, prioritization, flow control, and efficient TLS processing are enabled.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;server-push&#34;&gt;Server Push&lt;/h3&gt;
&lt;p&gt;HTTP/2 allows the server to send files that the client will likely need, such as JavaScript, CSS, fonts, and image files, together with a single HTTP response even if the client did not explicitly request them.&lt;/p&gt;
&lt;p&gt;This is useful when the server can predict which resources the client will require. When the server receives a request for an HTML document, it can push resources linked by that document, such as images and CSS files, to the client. This reduces traffic and round-trip delay caused by the client parsing the HTML and requesting required resources again.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/http/http-server-push.png&#34; alt=&#34;Server Push&#34;&gt;&lt;/p&gt;
&lt;h4 id=&#34;benefits-of-server-push&#34;&gt;Benefits of Server Push&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;The client stores pushed resources in cache.&lt;/li&gt;
&lt;li&gt;Cached resources can be reused across multiple pages.&lt;/li&gt;
&lt;li&gt;The server can send pushed resources together with requested information using multiplexing.&lt;/li&gt;
&lt;li&gt;The server can prioritize pushed resources.&lt;/li&gt;
&lt;li&gt;The client can manage optional resources, reject pushed resources, or disable server push.&lt;/li&gt;
&lt;li&gt;The client can limit the number of multiplexed push streams.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stream-prioritization&#34;&gt;Stream Prioritization&lt;/h3&gt;
&lt;p&gt;Streams can have priorities. In other words, the client can specify its preferred way of receiving responses.&lt;/p&gt;
&lt;p&gt;For example, if a document contains one CSS file and two image files, receiving the CSS file later than the images may cause rendering problems. HTTP/2 can solve resource loading problems by setting priorities based on dependencies between resources.&lt;/p&gt;
&lt;p&gt;Every stream also has a unique identifier. A stream identifier once used in a connection cannot be reused.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://http2.github.io/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HTTP2 | Github&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://web.dev/performance-http2/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Introduction to HTTP/2&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://factory.dev/blog/http2-difference-from-http1&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;HTTP/2: the difference between HTTP/1.1, benefits and how to use it&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>HTTP</category>
      
    </item>
    
    <item>
      <title>CORS</title>
      <link>https://www.devkuma.com/en/docs/http/cors/</link>
      <pubDate>Thu, 27 May 2021 10:59:45 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/http/cors/</guid>
      <description>
        
        
        &lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;Modern web browsers apply the &lt;a href=&#34;https://www.rfc-editor.org/info/rfc6454&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Same-Origin Policy&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt; to prevent information held by one website from being abused by another malicious website.&lt;/p&gt;
&lt;p&gt;For example, when a frontend communicates with a backend API on a different domain and requests resources, an error occurs because the Origin, meaning domain, protocol, and port number, is different. If a page at &lt;code&gt;https://api.devkuma.com/&lt;/code&gt; tries to read data over HTTP(S) from another website, &lt;code&gt;https://www.devkuma.com/&lt;/code&gt;, using XMLHttpRequest (XHR) or the Fetch API, an error occurs.&lt;/p&gt;
&lt;p&gt;However, if even trusted websites used for data integration are blocked, it becomes inconvenient. CORS (Cross-Origin Resource Sharing) is needed so that websites allowed to access data can do so even when the Origin is different.&lt;/p&gt;
&lt;h2 id=&#34;what-is-cors&#34;&gt;What Is CORS?&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;CORS stands for Cross-Origin Resource Sharing and means resource sharing between origins.&lt;/li&gt;
&lt;li&gt;Browsers generally prohibit communication between different origins, but CORS settings allow communication between different origins.&lt;/li&gt;
&lt;li&gt;It is a method that permits data to be received from a domain different from the page being viewed in the browser.&lt;/li&gt;
&lt;li&gt;It is used by browsers to prevent cross-site scripting for security.&lt;/li&gt;
&lt;li&gt;There is a restriction that communication can only occur with the origin domain&amp;rsquo;s server.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;what-is-origin&#34;&gt;What Is Origin?&lt;/h3&gt;
&lt;p&gt;To understand CORS more precisely, you need to understand origin. The origin of web content is defined by the URL scheme (protocol), host (domain), and port used to access that content. Two objects are considered to have the same origin only when all three match.&lt;/p&gt;
&lt;p&gt;On the web, work is limited to same-origin content by the Same-Origin Policy, and this restriction can be relaxed using CORS.&lt;/p&gt;
&lt;h4 id=&#34;same-origin-examples&#34;&gt;Same Origin Examples&lt;/h4&gt;
&lt;p&gt;The scheme (&lt;code&gt;http&lt;/code&gt;) and host (&lt;code&gt;www.devkuma.com&lt;/code&gt;) are the same, so they are the same origin.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;http://www.devkuma.com/app1/index.html
http://www.devkuma.com/app2/index.html
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The server uses the default port 80 and serves HTTP content, so it is the same origin.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;http://www.devkuma.com:80
http://www.Devkuma.com
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;different-origin-examples&#34;&gt;Different Origin Examples&lt;/h4&gt;
&lt;p&gt;Different scheme:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;http://devkuma.com/app1
https://devkuma.com/app2
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Different host:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;http://devkuma.com
http://www.devkuma.com
http://blog.example.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Different port:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;http://www.devkuma.com
http://www.devkuma.com:8080
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;why-is-cors-necessary&#34;&gt;Why Is CORS Necessary?&lt;/h2&gt;
&lt;p&gt;Browsers adopt the same-origin policy for security reasons. It is used to prevent other origins from freely accessing your resources.&lt;/p&gt;
&lt;p&gt;If a site you do not operate can obtain session requests, that site may hijack your session and perform malicious actions. Therefore, browsers block these requests.&lt;/p&gt;
&lt;p&gt;Phishing sites are a representative attack example, and CORS is needed to stop such attacks and allow requests only from origins that you have permitted.&lt;/p&gt;
&lt;h2 id=&#34;how-cors-works&#34;&gt;How CORS Works&lt;/h2&gt;
&lt;p&gt;When the browser requests a resource, it includes additional information in headers: what the origin is, which method will be used, and which headers will be included. The server sends back the origins it can respond to in response headers. The browser checks these headers and allows the resource transfer if the request is allowed from that origin; otherwise, it raises an error.&lt;/p&gt;
&lt;h2 id=&#34;cors-preflight-request&#34;&gt;CORS Preflight Request&lt;/h2&gt;
&lt;p&gt;This is a system composed of HTTP header exchanges. The browser determines whether frontend JavaScript code may access the response to a cross-origin request.&lt;/p&gt;
&lt;h3 id=&#34;request-headers&#34;&gt;Request Headers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Origin&lt;/code&gt;: shows which origin is accessing.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Request-Method&lt;/code&gt;: tells the server which method will be used in the actual request during a preflight request.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Request-Headers&lt;/code&gt;: tells the server which headers will be used in the actual request during a preflight request.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;response-headers&#34;&gt;Response Headers&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt;: allows the browser to access the resource from that origin. &lt;code&gt;*&lt;/code&gt; allows access from all origins only for requests without credentials.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Expose-Headers&lt;/code&gt;: lists which headers may be exposed as part of the response.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Max-Age&lt;/code&gt;: indicates how long preflight request results can be cached.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Allow-Credentials&lt;/code&gt;: indicates whether the response to a request can be exposed when credentials are true.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Allow-Methods&lt;/code&gt;: indicates methods allowed in response to a preflight request.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt;: indicates HTTP headers that can be used in the actual request.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;cors-examples&#34;&gt;CORS Examples&lt;/h2&gt;
&lt;p&gt;The examples describe allowing HTTP(S) access from &lt;code&gt;https://www.devkuma.com&lt;/code&gt; to &lt;code&gt;https://api.devkuma.com&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;allowing-simple-data-loading&#34;&gt;Allowing Simple Data Loading&lt;/h3&gt;
&lt;p&gt;To allow GET and POST from XHR or Fetch API, the client declares CORS for Fetch, and the server adds appropriate information to the HTTP response headers.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;var&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;xhr&lt;/span&gt; &lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;XMLHttpRequest&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;xhr&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;open&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;GET&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;https://api.devkuma.com&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;xhr&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;addEventListener&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;load&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000&#34;&gt;onLoadFunc&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;false&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;xhr&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;send&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#204a87;font-weight:bold&#34;&gt;null&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000&#34;&gt;fetch&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;https://api.devkuma.com&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#000&#34;&gt;mode&lt;/span&gt;&lt;span style=&#34;color:#ce5c00;font-weight:bold&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#4e9a06&#34;&gt;&amp;#39;cors&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;}).&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;then&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color:#000&#34;&gt;onLoadFunc&lt;/span&gt;&lt;span style=&#34;color:#000;font-weight:bold&#34;&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;GET /api HTTP/1.1
Origin: https://www.devkuma.com
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://www.devkuma.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For simple cases, a wildcard can be used.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;allowing-cookies&#34;&gt;Allowing Cookies&lt;/h3&gt;
&lt;p&gt;To allow cookies to be sent and received during HTTP(S) communication, both the browser and server need configuration. In this case, wildcard values are not allowed for &lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://www.devkuma.com
Access-Control-Allow-Credentials: true
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;using-detailed-http-communication&#34;&gt;Using Detailed HTTP Communication&lt;/h3&gt;
&lt;p&gt;If the request method is not GET, POST, or HEAD, or if special request headers or content types are used, CORS performs an OPTIONS preflight request before the actual request.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;OPTIONS /api HTTP/1.1
Access-Control-Request-Method: {request HTTP method}
&lt;/code&gt;&lt;/pre&gt;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://www.devkuma.com
Access-Control-Allow-Methods: GET,POST,HEAD,OPTIONS
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If custom request headers such as &lt;code&gt;X-MyRequest&lt;/code&gt; and &lt;code&gt;X-MyOption&lt;/code&gt; are used, the server must allow those headers using &lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt;. If custom response headers should be readable by the browser, the server must specify them with &lt;code&gt;Access-Control-Expose-Headers&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Preflight request results can be cached using &lt;code&gt;Access-Control-Max-Age&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/ko/docs/Web/HTTP/CORS&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Cross-Origin Resource Sharing (CORS)&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://hannut91.github.io/blogs/infra/cors&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;What is CORS? - Yunseok&amp;rsquo;s Dev Blog&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>HTTP</category>
      
      <category>CORS</category>
      
    </item>
    
  </channel>
</rss>
