<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Http on Commentary of Takao</title><link>https://takao.blog/en/tags/http/</link><description>Recent content in Http on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>Commentary of Takao</copyright><lastBuildDate>Sat, 13 Jun 2026 23:11:50 +0900</lastBuildDate><atom:link href="https://takao.blog/en/tags/http/index.xml" rel="self" type="application/rss+xml"/><item><title>Speeding Up assets Loading using DNS-Prefetch and Preconnect</title><link>https://takao.blog/en/web/performance-dns-prefetch-preconnect/</link><pubDate>Wed, 15 Apr 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/performance-dns-prefetch-preconnect/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Speeding Up assets Loading using DNS-Prefetch and Preconnect" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;Every external resource — fonts, scripts, images, API endpoints — requires a network connection. The overhead of &lt;strong&gt;DNS resolution&lt;/strong&gt;, &lt;strong&gt;TCP handshake&lt;/strong&gt;, and &lt;strong&gt;TLS negotiation&lt;/strong&gt; can add hundreds of milliseconds to page load time. &lt;strong&gt;Resource hints&lt;/strong&gt; like &lt;code&gt;dns-prefetch&lt;/code&gt; and &lt;code&gt;preconnect&lt;/code&gt; let you tell the browser to perform these steps &lt;strong&gt;in advance&lt;/strong&gt;, before the resource is actually needed.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="the-cost-of-connection"&gt;The Cost of Connection
&lt;/h2&gt;&lt;p&gt;Establishing an HTTPS connection involves multiple round trips:&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Step&lt;/th&gt;
					&lt;th&gt;Latency (approx.)&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;DNS lookup&lt;/td&gt;
					&lt;td&gt;20-120 ms&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;TCP handshake&lt;/td&gt;
					&lt;td&gt;1 RTT&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;TLS negotiation&lt;/td&gt;
					&lt;td&gt;2 RTT&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;strong&gt;Total&lt;/strong&gt;&lt;/td&gt;
					&lt;td&gt;&lt;strong&gt;3+ RTT&lt;/strong&gt;&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;On a 3G connection (300ms RTT), that&amp;rsquo;s nearly &lt;strong&gt;1 second&lt;/strong&gt; of overhead before any data is transferred. Resource hints eliminate most of this.&lt;/p&gt;</description></item><item><title>How CORS Works and Fixing Access Block Errors</title><link>https://takao.blog/en/web/web-security-http-headers-cors/</link><pubDate>Mon, 15 Dec 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/web-security-http-headers-cors/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post How CORS Works and Fixing Access Block Errors" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;CORS (Cross-Origin Resource Sharing)&lt;/strong&gt; is a browser security mechanism that controls how web pages from one origin can request resources from a different origin. When a frontend at &lt;code&gt;https://app.example.com&lt;/code&gt; tries to fetch data from &lt;code&gt;https://api.example.org&lt;/code&gt;, the browser enforces a &lt;strong&gt;same-origin policy&lt;/strong&gt; by default. CORS provides a controlled way to relax this policy through HTTP headers. This article explains the complete CORS flow, preflight requests, and how to fix common access-block errors.&lt;/p&gt;</description></item><item><title>Secure Cookie Configuration: A Complete Web Developer Guide</title><link>https://takao.blog/en/web/secure-cookies/</link><pubDate>Mon, 09 Dec 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/secure-cookies/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Secure Cookie Configuration: A Complete Web Developer Guide" /&gt;&lt;p&gt;Cookies remain one of the most frequently misconfigured security controls on the web. A single missing attribute can expose your application to session hijacking, CSRF, or cross-site information leakage. Modern browsers have pushed stricter defaults, but understanding each attribute and combining them correctly is essential for defense-in-depth.&lt;/p&gt;
&lt;p&gt;The core security attributes are &lt;code&gt;Secure&lt;/code&gt;, &lt;code&gt;HttpOnly&lt;/code&gt;, &lt;code&gt;SameSite&lt;/code&gt;, and the &lt;code&gt;__Host-&lt;/code&gt; / &lt;code&gt;__Secure-&lt;/code&gt; prefixes. Each serves a distinct purpose, and they work best when combined.&lt;/p&gt;</description></item></channel></rss>