<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ansh Dhanani</title>
    <description>The latest articles on DEV Community by Ansh Dhanani (@dhanani_ansh).</description>
    <link>https://dev.to/dhanani_ansh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3564462%2F02a3303b-8c66-485a-b462-269e8c667736.jpg</url>
      <title>DEV Community: Ansh Dhanani</title>
      <link>https://dev.to/dhanani_ansh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhanani_ansh"/>
    <language>en</language>
    <item>
      <title>Shipping Faster in Full-Stack Development (2026) with AI Orchestration</title>
      <dc:creator>Ansh Dhanani</dc:creator>
      <pubDate>Wed, 28 Jan 2026 10:57:34 +0000</pubDate>
      <link>https://dev.to/dhanani_ansh/shipping-faster-in-full-stack-development-2026-with-ai-orchestration-8ck</link>
      <guid>https://dev.to/dhanani_ansh/shipping-faster-in-full-stack-development-2026-with-ai-orchestration-8ck</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqfdz0j1g6ybm7441ziq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvqfdz0j1g6ybm7441ziq.png" alt=" " width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Why it matters?
&lt;/h1&gt;

&lt;p&gt;lets say we have two guys. Where one is a giga chad coder guy who writes all code by himself and if he get stuck he just see docs. second is my type of guy who is a vibe-coder but not any other vibe-coder a Efficiency-level-V vibe-coder (I'll tell you why).&lt;/p&gt;

&lt;p&gt;so here is a thing, when they both start a big project. the giga chad starts from scratch and write everything which is not a bad thing also he knows every whys of his code, but after all this talk about giga chad if you see at the other one, he had already completed 90% of project with all best practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  how did he do that?
&lt;/h2&gt;

&lt;p&gt;that's what you'll learn in this blog later.&lt;/p&gt;

&lt;h2&gt;
  
  
  so who is better?
&lt;/h2&gt;

&lt;p&gt;there was a time when AI was not that impactful and people said its better to write slow and by own than from an AI assistance. but time is changed now yesterday an "open source model Kimi k2" by Moonshot AI just released and benchmark said it even better than claude opus 4.5. let me remind you claude opus 4.5 is a devil of coding complex logic.&lt;/p&gt;

&lt;p&gt;so, what i'm trying to say is, if you really know how to orchestrate this models you can actually ship products faster and more importantly robust.&lt;/p&gt;

&lt;h1&gt;
  
  
  here's how you can do it too.
&lt;/h1&gt;

&lt;p&gt;if you are a college student, you can get github pro using you college id and use some monthly free premium credits of claude sonnet 4.5 for free (thanks github). it also give other models but claude sonnet 4.5 is best among them.&lt;/p&gt;

&lt;p&gt;now you have claude waiting to be used.&lt;/p&gt;

&lt;p&gt;Lets dive into the best practices i used for best results.&lt;/p&gt;




&lt;h3&gt;
  
  
  Point 1: learn how to prompt efficiently.
&lt;/h3&gt;

&lt;p&gt;when i was in early stage of learning ai agents for coding, i used to tell chatgpt "hey chatgpt fix this error." back then, it wasn't even able to get the problem to start with.&lt;/p&gt;

&lt;p&gt;as i keep playing with it i come to know that you have to give full context about the problem or the thing you it to do. you have to keep in mind you have to give one prompt in which you have to write the clear problem and what path to follow and what not to too.&lt;/p&gt;

&lt;p&gt;for example:&lt;/p&gt;

&lt;p&gt;bad one:&lt;br&gt;
“Fix the backend bug.”&lt;/p&gt;

&lt;p&gt;Better prompt (structured):&lt;br&gt;
“In our Express + Prisma backend, the POST /users endpoint fails when email already exists. Prisma throws a unique constraint error. We want to return a 409 response instead of crashing the server. Suggest a fix and include proper error handling patterns.”&lt;/p&gt;

&lt;p&gt;remember to give full context weather it is about the error on browser console, typescript error ,compilation fails, refactor (very problematic) everything that you think it should know about everything. as a developer you must know how every thing works and why you choose what and all. you can't just let it do anything it wants, it will be just another useless slop and waste of credits.&lt;/p&gt;

&lt;p&gt;you should utilized each and every feature of you IDE. many people says cursor is better. let me tell you i have tried cursor, windsurf, lazy vim, emacs(Salute to those who use this), Jetbrain(nice one) and of course my personal favorite VS code. and i can tell you that it doesn't actually matters that much.&lt;/p&gt;

&lt;p&gt;talking about vs code features, you must use include files or folder in prompt feature(present in most IDEs) you want to change. you must be aware what you are give access, turns out you just expose your .env secrets and now openai asking you for 2421$ lol. also there are bunch of nice extentions which are very useful, you can check that out too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Point 2: Never start from scratch.
&lt;/h3&gt;

&lt;p&gt;if you are in any hackathon or starting any projects by your own (here i'm not talking about yt toutorials projects).&lt;/p&gt;

&lt;p&gt;IT IS BETTER TO START WITH TEMPLATE.&lt;/p&gt;

&lt;p&gt;you might be thinking that this is laziness. but let me tell you something, lazy smart coders are the best category of coders. They are the one who find short and best pathways using their laziness. funny but its fact.&lt;/p&gt;

&lt;p&gt;so, you might ask me Ansh where can we find clean templates for starters,&lt;br&gt;
as a developer if we talk about nextjs specifically, vercel have pretty nice templates. but you can find you perfect match from github too (i know it is little slow process but sometimes you can get a gem).&lt;/p&gt;

&lt;p&gt;I’m participating in a hackathon at IIT Gandhinagar with my team, and we needed to create an admin dashboard for our problem statement. What I did was use a ready-made shadcn admin dashboard template. I then used Claude Desktop and connected it with Desktop MCP, writing a big prompt that detailed everything we wanted in a &lt;code&gt;markdown.md&lt;/code&gt; file — basically everything about the problem, the tech stack, and the libraries to use. I kept an eye on it to make sure nothing went wrong. Now we have a clean project that doesn’t break.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Librarys.
&lt;/h2&gt;

&lt;p&gt;let's say you have a very nice project you working on, and you have to add a feature, the problem is you don't know how to do it.&lt;/p&gt;

&lt;p&gt;depending upon size and complexity of the feature, you sometime might not need any library, but if you have a big feature and you are supposed to handle many states at ones or anything complex, you must use a library rather than just asking ai to impliment it. it happens with me countless times that i asked it to implement a simple feature and it create all hooks and library fuctions inside component file, while i am having a separate clean structure to handle both types of files, but the ai doesn't know about my folder structure at all it just know that one component.&lt;/p&gt;

&lt;h1&gt;
  
  
  conclusion
&lt;/h1&gt;

&lt;p&gt;The giga chad's way works for adding critical features to already going projects.&lt;/p&gt;

&lt;p&gt;For project foundation and clean start you must follow efficient vibe coder way.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>HTTP Protocol Explained: The Complete Practical Guide for Developers</title>
      <dc:creator>Ansh Dhanani</dc:creator>
      <pubDate>Sun, 28 Dec 2025 12:33:59 +0000</pubDate>
      <link>https://dev.to/dhanani_ansh/as-a-developer-this-is-all-you-need-to-know-about-the-http-protocol-23ld</link>
      <guid>https://dev.to/dhanani_ansh/as-a-developer-this-is-all-you-need-to-know-about-the-http-protocol-23ld</guid>
      <description>&lt;h1&gt;
  
  
  The HTTP Guide for Developers
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;A practical guide to HTTP. No fluff—just what you need to build better applications and debug faster.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is HTTP?&lt;/li&gt;
&lt;li&gt;Why HTTP Matters&lt;/li&gt;
&lt;li&gt;HTTP Versions&lt;/li&gt;
&lt;li&gt;HTTP Messages&lt;/li&gt;
&lt;li&gt;HTTP Headers&lt;/li&gt;
&lt;li&gt;HTTP Methods&lt;/li&gt;
&lt;li&gt;Status Codes&lt;/li&gt;
&lt;li&gt;Idempotency&lt;/li&gt;
&lt;li&gt;CORS&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Content Negotiation&lt;/li&gt;
&lt;li&gt;Compression&lt;/li&gt;
&lt;li&gt;Persistent Connections&lt;/li&gt;
&lt;li&gt;Streaming&lt;/li&gt;
&lt;li&gt;HTTPS&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What is HTTP?
&lt;/h2&gt;

&lt;p&gt;HTTP (HyperText Transfer Protocol) is the fundamental language that powers the entire web. Think of it as the universal translator that allows your browser, mobile apps, and backend services to communicate with servers across the internet. Every time you load a website, check your email, or scroll through social media, HTTP is working behind the scenes, shuttling data back and forth in a structured, predictable way.&lt;/p&gt;

&lt;p&gt;At its core, HTTP operates on a beautifully simple principle: one device asks for something (the client), and another device responds with that thing (the server). This request-response model is what makes the web work. When you type a URL into your browser or your app fetches data from an API, that's an HTTP request flying across the network. The server processes that request and sends back an HTTP response containing the data you asked for—or an error message if something went wrong.&lt;/p&gt;

&lt;p&gt;Here's what a basic interaction looks like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgd6fs65793f8rsrgstyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgd6fs65793f8rsrgstyw.png" alt="client-server req/res" width="773" height="404"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Browser  →  "GET /users/123 HTTP/1.1 headers..."  →  Server
Your Browser  ←  "HTTP/1.1 200 OK headers... {data}"   ←  Server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The beauty of HTTP is that it's &lt;strong&gt;text-based&lt;/strong&gt; (in HTTP/1.x), which means humans can actually read and understand what's being sent. This makes debugging infinitely easier compared to binary protocols where you're staring at gibberish. You can literally open your browser's developer tools right now, go to the Network tab, and watch HTTP messages flying back and forth in real-time. Try it—it's oddly satisfying.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding Statelessness
&lt;/h3&gt;

&lt;p&gt;Now here's where HTTP gets interesting: it's &lt;strong&gt;stateless&lt;/strong&gt;, meaning the server has zero memory of previous requests. Each request is treated as a completely fresh interaction, as if the server has never met you before. This might sound like a limitation at first—and honestly, it can be frustrating when you're starting out—but it's actually one of HTTP's greatest strengths.&lt;/p&gt;

&lt;p&gt;Why? Because statelessness makes scaling trivial. If every request is independent, any server in a cluster can handle any request. You don't need "sticky sessions" or complex state synchronization between servers. User sends Request A to Server 1? Cool. Request B goes to Server 2? Also fine. The servers don't need to coordinate because there's no state to keep track of.&lt;/p&gt;

&lt;p&gt;Let's see this in action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Request 1: &lt;/span&gt;&lt;span class="nf"&gt;GET&lt;/span&gt; &lt;span class="nn"&gt;/cart&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"What cart? And first of all, who are you?"&lt;/span&gt;

Request 2: GET /cart HTTP/1.1  
Response: "Still don't know you. Who dis?"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So how do websites "remember" you? They cheat. We add state back using &lt;strong&gt;cookies&lt;/strong&gt; or &lt;strong&gt;tokens&lt;/strong&gt;. The server gives you a unique identifier (like a session ID), and you send it with every request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="nf"&gt;GET&lt;/span&gt; &lt;span class="nn"&gt;/cart&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Cookie&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;session_id=abc123&lt;/span&gt;

Response: "Ah yes, session abc123! Here's your cart with 3 items."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server looks up your session ID in a database (like Redis) and retrieves your cart data. Boom—stateful behavior built on a stateless protocol. It's like showing your ID card every time you enter a building instead of the security guard remembering your face.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Request-Response Contract
&lt;/h3&gt;

&lt;p&gt;HTTP follows a strict contract: the client always initiates, the server always responds. The server never sends unsolicited data (that's what WebSockets are for). This asymmetry keeps things simple and predictable. Every HTTP conversation follows the same dance:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Client opens connection&lt;/strong&gt; (usually TCP on port 80 or 443)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client sends request&lt;/strong&gt; ("I want this resource")&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server processes request&lt;/strong&gt; (database queries, business logic, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server sends response&lt;/strong&gt; ("Here's what you asked for" or "Nope, can't do that")&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connection closes&lt;/strong&gt; (or stays open for more requests)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This predictable pattern is why HTTP is so reliable. There's no ambiguity about who's talking when, no complex state machines to debug. Request comes in, response goes out. Simple. Elegant. Effective.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why HTTP Matters
&lt;/h2&gt;

&lt;p&gt;Imagine trying to build the internet without a standard protocol. Every website would invent its own communication rules, every API would require a custom client, and developers would spend more time writing protocol adapters than building actual features. It would be absolute chaos—like trying to have a conversation where everyone speaks a different language with no translators available.&lt;/p&gt;

&lt;p&gt;HTTP solved this problem by giving us a universal standard. Whether you're talking to GitHub's API, Stripe's payment system, or your own backend, the protocol is identical. Same request format, same response structure, same status codes, same headers. This standardization is so fundamental to the web that we take it for granted, but it's genuinely revolutionary. One &lt;code&gt;fetch()&lt;/code&gt; call works for thousands of different services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Same exact pattern, completely different services&lt;/span&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.github.com/users/octocat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.stripe.com/v1/charges&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://yourcompany.com/api/orders&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No special configuration, no custom libraries, no protocol negotiation—just HTTP. This is the magic of standardization.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Hidden Benefits You Get for Free
&lt;/h3&gt;

&lt;p&gt;When you use HTTP, you're not just getting a protocol—you're getting an entire ecosystem that has evolved over 30+ years. &lt;strong&gt;Built-in caching&lt;/strong&gt; means browsers and CDNs automatically cache your responses if you set the right headers. You don't need to build a caching layer; it's already there, waiting for you to use it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cache-Control: public, max-age=3600
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That single header tells every intermediary between your server and the user to cache this response for an hour. Millions of requests saved, zero extra code written. That's leverage.&lt;/p&gt;

&lt;p&gt;Then there's the &lt;strong&gt;tooling ecosystem&lt;/strong&gt;. Because HTTP is standardized, we have incredible tools that work with any HTTP service: browser DevTools show you every request with full headers and timing information, Postman lets you craft complex API requests with a GUI, cURL gives you command-line superpowers, and monitoring tools like DataDog can analyze HTTP traffic patterns across your entire infrastructure. All of this exists because HTTP is standardized.&lt;/p&gt;

&lt;h3&gt;
  
  
  Statelessness: The Scalability Superpower
&lt;/h3&gt;

&lt;p&gt;Here's where HTTP's stateless design becomes a massive advantage. In the old days, servers used to maintain session state in memory. This worked fine for small applications, but it created a nightmare for scaling. If Server A knew about your session but Server B didn't, load balancers had to implement "sticky sessions" to route all your requests to Server A. This meant uneven load distribution, difficult failover, and complex infrastructure.&lt;/p&gt;

&lt;p&gt;HTTP's statelessness cuts through this complexity like a hot knife through butter. Because each request is independent, any server can handle any request. Your first request goes to Server 1 in California? Cool. Your next request goes to Server 2 in Virginia? Also fine. Neither server needs to know about the other, and both can process your request by looking up your session token in a shared database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4goivz2ezy3w2upicbk2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4goivz2ezy3w2upicbk2.png" alt=" " width="615" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This architecture is simple, reliable, and scales horizontally. Need more capacity? Spin up more servers. No complex state synchronization, no session migration, no headaches. This is why modern web applications can serve millions of users—HTTP's stateless design makes it almost trivially easy to scale.&lt;/p&gt;

&lt;p&gt;When you combine all these benefits—universal compatibility, free caching, incredible tooling, and effortless scaling—you start to understand why HTTP has dominated the web for three decades and shows no signs of going away. It's not just a protocol; it's the foundation that makes the entire internet economy possible.&lt;/p&gt;




&lt;h2&gt;
  
  
  HTTP Versions: Evolution Through Real Problems
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What an actual http request/response look like?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w6igd56cn9tdzkhcdoy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w6igd56cn9tdzkhcdoy.png" alt=" " width="800" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HTTP has evolved through three major versions, each solving critical performance bottlenecks that became apparent as the web grew. Understanding this evolution isn't just history—it's understanding the performance characteristics and limitations of the systems you're building today.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/1.1 (1997) - The Foundation
&lt;/h3&gt;

&lt;p&gt;HTTP/1.1 was the protocol that took the web mainstream. It introduced &lt;strong&gt;persistent connections&lt;/strong&gt; (keep-alive), which meant you could send multiple requests over a single TCP connection instead of opening a new connection for every request. This was huge—establishing a TCP connection involves a three-way handshake that takes at least one round-trip time, and with the old HTTP/1.0 model, a page with 50 resources meant 50 TCP handshakes. That's a lot of wasted time and bandwidth.&lt;/p&gt;

&lt;p&gt;With persistent connections, you connect once and reuse that connection:&lt;/p&gt;

&lt;h3&gt;
  
  
  TCP 3 way handshake
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqk6pn31e6jrp355p5o8d.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqk6pn31e6jrp355p5o8d.jpg" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Connect (TCP handshake: 50-100ms)
Request 1 → Response 1
Request 2 → Response 2  
Request 3 → Response 3
[... many more requests ...]
Disconnect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;HTTP/1.1 also gave us &lt;strong&gt;chunked transfer encoding&lt;/strong&gt;, which lets servers start sending data before they know the total size. This is critical for streaming use cases—imagine trying to stream a video if you had to buffer the entire file first to calculate Content-Length. Chunked encoding solved this by letting the server send data in pieces with each piece prefixed by its size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But HTTP/1.1 had a fatal flaw&lt;/strong&gt;: head-of-line blocking. Requests were still processed sequentially over each connection. Even though you had persistent connections, you couldn't truly parallelize requests. If Request 1 took 5 seconds, Request 2 had to wait those full 5 seconds before it could even start. Browsers worked around this by opening multiple connections (typically 6 per domain), but this was a hack, not a solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/2 (2015) - The Performance Revolution
&lt;/h3&gt;

&lt;p&gt;HTTP/2 fundamentally changed how data flows over a connection with &lt;strong&gt;multiplexing&lt;/strong&gt;—the ability to send multiple requests and receive multiple responses simultaneously over a single connection. Instead of requests waiting in line, they all fly at once:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frja9vtj9tt41el4xc0qn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frja9vtj9tt41el4xc0qn.png" alt=" " width="800" height="414"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────────────────────────┐
│   Single TCP Connection          │
├──────────────────────────────────┤
│ Stream 1: GET /style.css     ───▶│
│ Stream 2: GET /script.js     ───▶│
│ Stream 3: GET /image.png     ───▶│
│ Stream 1: 200 OK [CSS data]  ◀───│
│ Stream 3: 200 OK [IMG data]  ◀───│ (came back first!)
│ Stream 2: 200 OK [JS data]   ◀───│
└──────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how responses can come back out of order—Stream 3 finishes before Stream 2, and that's fine. No more head-of-line blocking at the HTTP layer. This change alone typically improves page load times by 30-50%.&lt;/p&gt;

&lt;p&gt;HTTP/2 also introduced &lt;strong&gt;header compression&lt;/strong&gt; using HPACK. HTTP/1.1 sent the same headers repeatedly with every request, wasting kilobytes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="nf"&gt;GET&lt;/span&gt; &lt;span class="nn"&gt;/api/users/1&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api.example.com&lt;/span&gt;
&lt;span class="na"&gt;User-Agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36...&lt;/span&gt;
&lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...&lt;/span&gt;
&lt;span class="na"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/json&lt;/span&gt;
&lt;span class="na"&gt;Cookie&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;session=abc123; prefs=dark_mode; ...&lt;/span&gt;

GET /api/users/2 HTTP/1.1
Host: api.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36...
[... exact same headers repeated ...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;HTTP/2 compresses these headers and remembers them across requests, so subsequent requests only send the differences. This saves significant bandwidth, especially for APIs where you make many requests with identical headers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The catch&lt;/strong&gt;: HTTP/2 still runs over TCP, and TCP has its own head-of-line blocking at the packet level. If a single TCP packet is lost, everything behind it stalls while that packet is retransmitted—even unrelated streams. This is especially painful on mobile networks with packet loss.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/3 (2022) - Breaking Free from TCP
&lt;/h3&gt;

&lt;p&gt;HTTP/3 made the radical decision to abandon TCP entirely and use &lt;strong&gt;QUIC over UDP&lt;/strong&gt; instead. This sounds crazy—UDP is the "unreliable" protocol, right? But QUIC implements reliability features on top of UDP while fixing TCP's fundamental limitations.&lt;/p&gt;

&lt;p&gt;The key innovation is &lt;strong&gt;per-stream head-of-line blocking&lt;/strong&gt;. In HTTP/2, a lost packet blocks all streams. In HTTP/3, a lost packet only blocks the stream it belongs to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Stream 1: [Packet 1] [LOST!] [Packet 3] → Stalls waiting for Packet 2
Stream 2: [Packet 1] [Packet 2] [Packet 3] → Keeps flowing!
Stream 3: [Packet 1] [Packet 2] → Keeps flowing!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is massive for mobile users. On spotty connections with 5% packet loss, HTTP/3 can be dramatically faster than HTTP/2 because lost packets don't stall unrelated requests.&lt;/p&gt;

&lt;p&gt;HTTP/3 also has &lt;strong&gt;built-in encryption&lt;/strong&gt; with TLS 1.3 integrated into QUIC. There's no separate TLS handshake—it's all one negotiation. Even better, HTTP/3 supports &lt;strong&gt;0-RTT resumption&lt;/strong&gt;, meaning if you've connected before, your first request can include data immediately without waiting for handshakes. This is perfect for mobile apps that frequently reconnect.&lt;/p&gt;

&lt;p&gt;Finally, HTTP/3 has &lt;strong&gt;connection migration&lt;/strong&gt;. When your phone switches from WiFi to cellular, TCP connections die and need to be reestablished. QUIC connections use connection IDs instead of IP addresses, so the connection seamlessly migrates to the new network. Your video keeps streaming, your API calls keep flowing—no interruption.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Current reality&lt;/strong&gt;: HTTP/3 is used by Google (all properties), Facebook, Cloudflare, and other major services. Browser support is universal. But server adoption is still growing because it requires new infrastructure. Most applications still run on HTTP/1.1 or HTTP/2, and that's fine—they work well. HTTP/3 is an optimization, not a requirement.&lt;/p&gt;

&lt;h3&gt;
  
  
  What This Means for You
&lt;/h3&gt;

&lt;p&gt;Here's the practical takeaway: &lt;strong&gt;you usually don't choose the HTTP version&lt;/strong&gt;—your hosting provider, CDN, or load balancer handles it. Your application code doesn't change between versions. The same Express/Flask/Spring Boot code works with all versions.&lt;/p&gt;

&lt;p&gt;What matters is understanding that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP/1.1 is sequential (slow with many requests)&lt;/li&gt;
&lt;li&gt;HTTP/2 is parallel (fast with many requests)
&lt;/li&gt;
&lt;li&gt;HTTP/3 is resilient (fast even on bad networks)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When debugging performance issues, check which version is being used. If you're on HTTP/1.1 and making 100 requests to load a page, upgrading to HTTP/2 might be your biggest performance win. If your mobile users complain about slow connections, HTTP/3 might help. But if you're making 5 API calls and they're already fast, the version doesn't matter much.&lt;/p&gt;




&lt;h2&gt;
  
  
  HTTP Messages
&lt;/h2&gt;

&lt;p&gt;Every HTTP interaction uses this format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌──────────────┐
│ Start Line   │ ← Method + Path or Status
├──────────────┤
│ Headers      │ ← Metadata
│ Header: value│
├──────────────┤
│ (blank line) │ ← Required separator
├──────────────┤
│ Body         │ ← Optional data
└──────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Request Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="nf"&gt;POST&lt;/span&gt; &lt;span class="nn"&gt;/api/users&lt;/span&gt; &lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt;
&lt;span class="na"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api.example.com&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/json&lt;/span&gt;
&lt;span class="na"&gt;Content-Length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;27&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"Alice"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"age"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Parts:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Request line&lt;/strong&gt;: &lt;code&gt;POST /api/users HTTP/1.1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Headers&lt;/strong&gt;: Host, Content-Type, Content-Length&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blank line&lt;/strong&gt;: Required!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Body&lt;/strong&gt;: JSON data&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Response Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;201&lt;/span&gt; &lt;span class="ne"&gt;Created&lt;/span&gt;
&lt;span class="na"&gt;Content-Type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;application/json&lt;/span&gt;
&lt;span class="na"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/api/users/123&lt;/span&gt;

&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"Alice"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Parts:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Status line&lt;/strong&gt;: &lt;code&gt;HTTP/1.1 201 Created&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Headers&lt;/strong&gt;: Content-Type, Location&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Blank line&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Body&lt;/strong&gt;: Created resource&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  HTTP Headers
&lt;/h2&gt;

&lt;p&gt;Headers are key-value pairs that provide metadata.&lt;/p&gt;

&lt;h3&gt;
  
  
  Critical Request Headers
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Host&lt;/strong&gt; (required)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Host: api.example.com
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Which server to route to&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authorization&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Authorization: Bearer eyJhbGc...
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Authentication credentials&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content-Type&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Content-Type: application/json
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Format of request body&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accept&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Accept: application/json
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What response formats you'll accept&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cookie&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cookie: session_id=abc123
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Send stored cookies&lt;/p&gt;

&lt;h3&gt;
  
  
  Critical Response Headers
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Content-Type&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Content-Type: application/json
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Format of response body&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set-Cookie&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Set-Cookie: session_id=abc123; HttpOnly; Secure
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Store cookie on client&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cache-Control&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cache-Control: public, max-age=3600
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Caching instructions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Location&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Location: /api/users/123
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Redirect or created resource URL&lt;/p&gt;

&lt;h3&gt;
  
  
  Security Headers (Must-Have)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Strict-Transport-Security&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Strict-Transport-Security: max-age=31536000
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Force HTTPS&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content-Security-Policy&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Content-Security-Policy: default-src 'self'
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prevent XSS attacks&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;X-Content-Type-Options&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;X-Content-Type-Options: nosniff
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prevent MIME sniffing&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;X-Frame-Options&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;X-Frame-Options: DENY
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prevent clickjacking&lt;/p&gt;

&lt;h3&gt;
  
  
  Cookie Attributes (Security)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Set-Cookie: session=abc; HttpOnly; Secure; SameSite=Strict
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HttpOnly&lt;/strong&gt;: JavaScript can't access (prevents XSS)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure&lt;/strong&gt;: HTTPS only (prevents MITM)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SameSite=Strict&lt;/strong&gt;: Blocks CSRF attacks&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  HTTP Headers — Reference Table
&lt;/h2&gt;

&lt;p&gt;Headers provide metadata and control behavior.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Header&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;th&gt;Common Values&lt;/th&gt;
&lt;th&gt;Usage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Host&lt;/td&gt;
&lt;td&gt;Target server&lt;/td&gt;
&lt;td&gt;&lt;code&gt;api.example.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Routing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authorization&lt;/td&gt;
&lt;td&gt;Credentials&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Bearer &amp;lt;token&amp;gt;&lt;/code&gt;, &lt;code&gt;Basic &amp;lt;base64&amp;gt;&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Content-Type&lt;/td&gt;
&lt;td&gt;Body format&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;application/json&lt;/code&gt;, &lt;code&gt;text/html&lt;/code&gt;, &lt;code&gt;multipart/form-data&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Parsing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Accept&lt;/td&gt;
&lt;td&gt;Desired response&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;application/json&lt;/code&gt;, &lt;code&gt;text/html&lt;/code&gt;, &lt;code&gt;*/*&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Content negotiation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Accept-Language&lt;/td&gt;
&lt;td&gt;Preferred language&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;en-US&lt;/code&gt;, &lt;code&gt;fr-FR&lt;/code&gt;, &lt;code&gt;hi-IN&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Localization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User-Agent&lt;/td&gt;
&lt;td&gt;Client info&lt;/td&gt;
&lt;td&gt;Browser, curl, Postman&lt;/td&gt;
&lt;td&gt;Analytics, debugging&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cookie&lt;/td&gt;
&lt;td&gt;Client state&lt;/td&gt;
&lt;td&gt;&lt;code&gt;session_id=abc123&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sessions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Set-Cookie&lt;/td&gt;
&lt;td&gt;Store cookie&lt;/td&gt;
&lt;td&gt;&lt;code&gt;HttpOnly; Secure; SameSite=Strict&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache-Control&lt;/td&gt;
&lt;td&gt;Caching&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;no-cache&lt;/code&gt;, &lt;code&gt;max-age=3600&lt;/code&gt;, &lt;code&gt;public&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Location&lt;/td&gt;
&lt;td&gt;Redirect or new resource&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/api/users/123&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Navigation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strict-Transport-Security&lt;/td&gt;
&lt;td&gt;Force HTTPS&lt;/td&gt;
&lt;td&gt;&lt;code&gt;max-age=31536000&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Content-Security-Policy&lt;/td&gt;
&lt;td&gt;Prevent XSS&lt;/td&gt;
&lt;td&gt;&lt;code&gt;default-src 'self'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;X-Content-Type-Options&lt;/td&gt;
&lt;td&gt;Prevent MIME sniffing&lt;/td&gt;
&lt;td&gt;&lt;code&gt;nosniff&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;X-Frame-Options&lt;/td&gt;
&lt;td&gt;Clickjacking protection&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;DENY&lt;/code&gt;, &lt;code&gt;SAMEORIGIN&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Transfer-Encoding&lt;/td&gt;
&lt;td&gt;Body transfer&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;chunked&lt;/code&gt;, &lt;code&gt;gzip&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Streaming/Compression&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connection&lt;/td&gt;
&lt;td&gt;Connection persistence&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;keep-alive&lt;/code&gt;, &lt;code&gt;close&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access-Control-Allow-Origin&lt;/td&gt;
&lt;td&gt;CORS origin&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;*&lt;/code&gt;, &lt;code&gt;https://example.com&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Cross-origin requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access-Control-Allow-Methods&lt;/td&gt;
&lt;td&gt;Allowed HTTP methods&lt;/td&gt;
&lt;td&gt;&lt;code&gt;GET, POST, PUT, DELETE, OPTIONS&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CORS control&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access-Control-Allow-Headers&lt;/td&gt;
&lt;td&gt;Allowed headers in CORS&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Authorization, Content-Type&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;CORS control&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  HTTP Methods
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Method&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;th&gt;Safe&lt;/th&gt;
&lt;th&gt;Idempotent&lt;/th&gt;
&lt;th&gt;Body&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GET&lt;/td&gt;
&lt;td&gt;Retrieve resource&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;POST&lt;/td&gt;
&lt;td&gt;Create resource&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PUT&lt;/td&gt;
&lt;td&gt;Replace resource&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PATCH&lt;/td&gt;
&lt;td&gt;Update resource&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;⚠️&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DELETE&lt;/td&gt;
&lt;td&gt;Remove resource&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OPTIONS&lt;/td&gt;
&lt;td&gt;Check capabilities&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Status Codes
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;### you are not supposed to remember all.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4m187klyicndkdddsfy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4m187klyicndkdddsfy.webp" alt=" " width="800" height="1017"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Mostly used Codes.
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Code&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;When to Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;OK&lt;/td&gt;
&lt;td&gt;Standard success&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;Resource created&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;Success without body&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;Permanent redirect&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;Use cached resource&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;Invalid input&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;Auth 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;No permission&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;Resource missing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;429&lt;/td&gt;
&lt;td&gt;Too Many Requests&lt;/td&gt;
&lt;td&gt;Rate limited&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;Server issue&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;Upstream issue&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;Temporary downtime&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  CORS
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;CORS (Cross-Origin Resource Sharing)&lt;/strong&gt;: Browser security that blocks cross-origin requests by default.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Problem
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// You're on https://frontend.com&lt;/span&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.backend.com/data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;// ❌ Blocked by browser!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  The Solution
&lt;/h3&gt;

&lt;p&gt;Server sends CORS headers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Access-Control-Allow-Origin: https://frontend.com
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: Content-Type
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Simple vs Preflight Requests
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Simple request&lt;/strong&gt; (no preflight):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /api/data
Origin: https://frontend.com

Response:
Access-Control-Allow-Origin: https://frontend.com
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Preflight request&lt;/strong&gt; (checks first):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;OPTIONS /api/data
Origin: https://frontend.com
Access-Control-Request-Method: POST
Access-Control-Request-Headers: Content-Type

Response:
Access-Control-Allow-Origin: https://frontend.com
Access-Control-Allow-Methods: POST
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400

Then actual POST request proceeds...
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Triggers preflight:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Methods: PUT, DELETE, PATCH&lt;/li&gt;
&lt;li&gt;Custom headers&lt;/li&gt;
&lt;li&gt;Content-Type: application/json&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36tmgjoa6ov9wswotcf2.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F36tmgjoa6ov9wswotcf2.webp" alt=" " width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Common CORS Setup
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Node.js/Express&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Access-Control-Allow-Origin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://frontend.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Access-Control-Allow-Methods&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;GET,POST,PUT,DELETE&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Access-Control-Allow-Headers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type,Authorization&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Access-Control-Allow-Credentials&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;method&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;OPTIONS&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Caching
&lt;/h2&gt;

&lt;p&gt;Caching saves bandwidth and improves speed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cache-Control Header
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Don't cache (sensitive data):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cache-Control: private, no-store
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cache for 1 hour:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cache-Control: public, max-age=3600
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cache but revalidate:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cache-Control: public, max-age=0, must-revalidate
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cache forever (static assets):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Cache-Control: public, max-age=31536000, immutable
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ETag (Smart Caching)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;First request:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /api/users/123

200 OK
ETag: "abc123"
{"id":123,"name":"Alice"}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Later request:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /api/users/123
If-None-Match: "abc123"

304 Not Modified
(no body - use cache)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;If data changed:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;200 OK
ETag: "xyz789"
{"id":123,"name":"Alice Updated"}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxjvuc0489vc6vdd011i4.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxjvuc0489vc6vdd011i4.webp" alt=" " width="800" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Cache Strategy by Content Type
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;# HTML pages
Cache-Control: public, max-age=0, must-revalidate

# API responses
Cache-Control: private, no-cache

# Static assets (CSS, JS, images with hash in filename)
Cache-Control: public, max-age=31536000, immutable

# User-specific data
Cache-Control: private, max-age=300

# Sensitive data
Cache-Control: private, no-store
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Content Negotiation
&lt;/h2&gt;

&lt;p&gt;Client and server agree on format/language.&lt;/p&gt;

&lt;h3&gt;
  
  
  Accept Header
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /api/users
Accept: application/json

Response:
Content-Type: application/json
{"users":[...]}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /page
Accept: text/html

Response:
Content-Type: text/html
&amp;lt;html&amp;gt;...&amp;lt;/html&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Accept-Language
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Accept-Language: es-MX, es;q=0.9, en;q=0.8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Translation: "I prefer Mexican Spanish, any Spanish is fine, English as backup"&lt;/p&gt;

&lt;h3&gt;
  
  
  Quality Values (q)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Accept: application/json, application/xml;q=0.9, */*;q=0.8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;q=1.0&lt;/code&gt; (default): Preferred&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;q=0.9&lt;/code&gt;: Less preferred&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;q=0.8&lt;/code&gt;: Least preferred&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Compression
&lt;/h2&gt;

&lt;p&gt;Compression reduces payload size significantly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Accept-Encoding
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /api/data
Accept-Encoding: gzip, br

Response:
Content-Encoding: gzip
[compressed data]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Compression Algorithms
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;gzip&lt;/strong&gt; (universal support)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Content-Encoding: gzip
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Brotli&lt;/strong&gt; (better compression, modern browsers)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Content-Encoding: br
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Real Impact
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Original: 1.2 MB
Gzipped:  300 KB
Savings:  75%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Always compress:&lt;/strong&gt; Text, JSON, HTML, CSS, JavaScript&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Don't compress:&lt;/strong&gt; Images (already compressed), videos&lt;/p&gt;


&lt;h2&gt;
  
  
  Persistent Connections
&lt;/h2&gt;

&lt;p&gt;Keep connections open for multiple requests.&lt;/p&gt;
&lt;h3&gt;
  
  
  HTTP/1.1 Keep-Alive
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Connection: keep-alive
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────────┐
│ Connect once                     │
│ Request 1 → Response 1           │
│ Request 2 → Response 2           │
│ Request 3 → Response 3           │
│ Disconnect                       │
└─────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;vs Old way:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Connect → Request 1 → Response 1 → Disconnect
Connect → Request 2 → Response 2 → Disconnect
Connect → Request 3 → Response 3 → Disconnect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Benefit:&lt;/strong&gt; Eliminates TCP handshake overhead (50-100ms per connection)&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/2 &amp;amp; HTTP/3
&lt;/h3&gt;

&lt;p&gt;Persistent connections built-in. No special headers needed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Streaming
&lt;/h2&gt;

&lt;p&gt;Send data without knowing total size.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chunked Transfer Encoding
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Transfer-Encoding: chunked

1a\r\n
This is the first chunk\r\n
14\r\n
This is the second\r\n
0\r\n
\r\n
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each chunk: size in hex + &lt;code&gt;\r\n&lt;/code&gt; + data + &lt;code&gt;\r\n&lt;/code&gt;&lt;br&gt;&lt;br&gt;
Last chunk: &lt;code&gt;0\r\n\r\n&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Real-World Uses
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Streaming API responses:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Server-sent events&lt;/span&gt;
&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/event-stream&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Transfer-Encoding&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;chunked&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`data: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()})}&lt;/span&gt;&lt;span class="s2"&gt;\n\n`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Streaming logs:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.example.com/logs/stream
&lt;span class="c"&gt;# Receives log lines as they're generated&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Video streaming:&lt;/strong&gt;&lt;br&gt;
Sends chunks as they're encoded/available&lt;/p&gt;


&lt;h2&gt;
  
  
  HTTPS
&lt;/h2&gt;

&lt;p&gt;HTTPS = HTTP + TLS encryption&lt;/p&gt;
&lt;h3&gt;
  
  
  Why HTTPS?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Without HTTPS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You → "password123" → [Anyone listening] → Server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;With HTTPS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You → [encrypted gibberish] → Server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even if intercepted, data is unreadable.&lt;/p&gt;

&lt;h3&gt;
  
  
  What HTTPS Provides
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Encryption&lt;/strong&gt;: Data can't be read&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authentication&lt;/strong&gt;: Server is who they claim&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrity&lt;/strong&gt;: Data can't be modified&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  TLS Handshake (Simplified)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client → Server: "Let's use HTTPS"
Server → Client: "Here's my certificate"
Client verifies certificate
Client → Server: [Encrypted session key]
Both use session key for encryption
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7gsofkjue2a3myt0hbha.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7gsofkjue2a3myt0hbha.png" alt=" " width="800" height="836"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Certificate Verification
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Browser checks:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Certificate not expired?&lt;/li&gt;
&lt;li&gt;Issued by trusted CA?&lt;/li&gt;
&lt;li&gt;Domain matches?&lt;/li&gt;
&lt;li&gt;Not revoked?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If all pass: 🔒 Green lock&lt;br&gt;&lt;br&gt;
If fail: ⚠️ Security warning&lt;/p&gt;
&lt;h3&gt;
  
  
  HTTP → HTTPS Upgrade
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Force HTTPS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="k"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="m"&gt;1.1&lt;/span&gt; &lt;span class="m"&gt;301&lt;/span&gt; &lt;span class="ne"&gt;Moved Permanently&lt;/span&gt;
&lt;span class="na"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://example.com&lt;/span&gt;
&lt;span class="na"&gt;Strict-Transport-Security&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;max-age=31536000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HSTS (HTTP Strict Transport Security):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Strict-Transport-Security: max-age=31536000; includeSubDomains
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Browser automatically uses HTTPS for all requests to this domain.&lt;/p&gt;




&lt;h2&gt;
  
  
  Debugging HTTP
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Browser DevTools
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;F12 → Network Tab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All requests/responses&lt;/li&gt;
&lt;li&gt;Headers&lt;/li&gt;
&lt;li&gt;Timing&lt;/li&gt;
&lt;li&gt;Payload size&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  cURL (Command Line)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Basic request&lt;/span&gt;
curl https://api.example.com/users

&lt;span class="c"&gt;# Show headers&lt;/span&gt;
curl &lt;span class="nt"&gt;-v&lt;/span&gt; https://api.example.com/users

&lt;span class="c"&gt;# POST with data&lt;/span&gt;
curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://api.example.com/users &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"name":"Alice"}'&lt;/span&gt;

&lt;span class="c"&gt;# Follow redirects&lt;/span&gt;
curl &lt;span class="nt"&gt;-L&lt;/span&gt; https://example.com

&lt;span class="c"&gt;# Save response&lt;/span&gt;
curl &lt;span class="nt"&gt;-o&lt;/span&gt; output.json https://api.example.com/data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Common Issues
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;CORS errors:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Check: Access-Control-Allow-Origin header
Fix: Add header on server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;401 Unauthorized:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Check: Authorization header present and valid
Fix: Include valid token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;304 Not Modified confusion:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Remember: 304 means use cached version (not an error!)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Unexpected status codes:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Check: What server is actually returning
Use: curl -v to see full response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Quick Reference
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Essential Headers Cheat Sheet
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Request:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Host: api.example.com              (required)
Authorization: Bearer &amp;lt;token&amp;gt;       (auth)
Content-Type: application/json      (body format)
Accept: application/json            (wanted format)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Response:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Content-Type: application/json      (body format)
Cache-Control: max-age=3600         (caching)
Access-Control-Allow-Origin: *      (CORS)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Security:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;Strict-Transport-Security: max-age=31536000
Content-Security-Policy: default-src 'self'
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Best Practices Summary
&lt;/h2&gt;

&lt;h3&gt;
  
  
  API Design
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use appropriate HTTP methods&lt;/li&gt;
&lt;li&gt;Return meaningful status codes&lt;/li&gt;
&lt;li&gt;Include proper headers (Content-Type, etc.)&lt;/li&gt;
&lt;li&gt;Implement caching where appropriate&lt;/li&gt;
&lt;li&gt;Version your API (URL or header)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Always use HTTPS in production&lt;/li&gt;
&lt;li&gt;Set security headers (HSTS, CSP, etc.)&lt;/li&gt;
&lt;li&gt;Use HttpOnly, Secure cookies&lt;/li&gt;
&lt;li&gt;Implement rate limiting&lt;/li&gt;
&lt;li&gt;Validate all inputs&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Performance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Enable compression (gzip/brotli)&lt;/li&gt;
&lt;li&gt;Use appropriate caching headers&lt;/li&gt;
&lt;li&gt;Leverage HTTP/2 if available&lt;/li&gt;
&lt;li&gt;Minimize payload size&lt;/li&gt;
&lt;li&gt;Use persistent connections&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Debugging
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Check Network tab first&lt;/li&gt;
&lt;li&gt;Use curl for API testing&lt;/li&gt;
&lt;li&gt;Include request IDs for tracing&lt;/li&gt;
&lt;li&gt;Log headers in development&lt;/li&gt;
&lt;li&gt;Test with real network conditions&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt; HTTP is simple at its core—requests and responses with headers and bodies. Everything else is optimization and security built on top of that foundation.&lt;/p&gt;

&lt;p&gt;Master these fundamentals, and you'll understand what's happening in any HTTP-based system.&lt;/p&gt;

&lt;h1&gt;
  
  
  The End
&lt;/h1&gt;

&lt;p&gt;Thank you for reading. Hope you don't need anything else to learn http.&lt;/p&gt;

</description>
      <category>networking</category>
      <category>programming</category>
      <category>architecture</category>
      <category>backend</category>
    </item>
  </channel>
</rss>
