惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
T
ThreatConnect
SecWiki News
SecWiki News
F
Future of Privacy Forum
AWS News Blog
AWS News Blog
C
Cisco Blogs
A
Arctic Wolf
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
Scott Helme
Scott Helme
V
V2EX
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
K
Kaspersky official blog
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
NISL@THU
NISL@THU
Microsoft Azure Blog
Microsoft Azure Blog
量子位
The Hacker News
The Hacker News
Stack Overflow Blog
Stack Overflow Blog
Security Latest
Security Latest
M
Microsoft Research Blog - Microsoft Research
Google Online Security Blog
Google Online Security Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
I
InfoQ
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
The Cloudflare Blog
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
Cisco Talos Blog
Cisco Talos Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Troy Hunt's Blog
F
Fox-IT International blog
S
Security @ Cisco Blogs
博客园 - 司徒正美
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
Comments on: Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
L
LINUX DO - 最新话题
GbyAI
GbyAI
Project Zero
Project Zero
腾讯CDC
T
Tailwind CSS Blog

DEV Community

LangGraph 워크플로우 템플릿 (v39) The git Commands You Forgot Exist (And Why AI Workflows Make Them Relevant Again) Six Levels of MCP Servers One container to replace Grafana + Loki + Tempo + Prometheus Python Week 3: We Stopped Repeating Ourselves (Loops!) Creating a Custom Grid Editor tool in Unreal Engine 我做了个付费 Telegram bot。Telegram Stars 实际给开发者多少钱,我算了一笔账。 I Got 96% Recall on LLM Hallucination Detection With No ML Model – Just 50 Lines of Python A practitioner's guide to getting more value out of AI coding: agent quality & token optimization How to Handle Telegram Albums in Telegraf I Built a Multilingual Spam Detection Dataset with 149K+ Messages Across 23 Languages How to Handle Telegram Albums in grammY RAG 시스템 실전 구축 (v38) Beyond Pip Install: Why Your AI Agent Needs a "Hermetic" Life-Support System to Survive Resume Building using HTML & CSS SpecFlow: Multi-Agent SDD in Cursor (4 phases, /approve, single code writer) Running ASR for smart homes in the NPU of Intel processors "Building a CI/CD Pipeline From Scratch: A Practical Guide for Developers (with GitHub Actions)" SpecFlow: SDD multi-agente en Cursor (4 fases, /approve, un solo escritor de código) How to Extract Your Full Team Hierarchy from HubSpot (the API doesn't expose it) Adobe Commerce Cloud now costs $40k/year. We migrated from Adobe Commerce to Magento Open Source — here's the honest breakdown .klickd v4.0.0 — Portable AI memory with constraints, strict schemas, and test vectors We Trust Third Party Code, It’s Time to Trust AI Generated Code LangGraph 워크플로우 템플릿 (v38) Sustainable AI Starts with Efficient AI Find Remove duplicated files in Google Drive How to Detect GPU Waste in a Kubernetes Cluster The Privacy Bug in My First Chrome Extension (And How to Avoid It) Serverless Mental Models: What They Don't Tell You Before You Build Preventing GPT hallucination in automated content pipelines: how I structure Make.com flows with data injection Hmm, where were we? AI Visibility Tools, Math Proofs, and Stripped Guardrails Shape Developer Landscape How AI and Electronics Are Changing Healthcare Devices: The Future of Smart Healthcare Author: Shivam Wakade | Founder, PrivSR Making Claude Sound Like Optimus Prime Understanding Reinforcement Learning with Human Feedback Part 5: Training the Reward Model with Loss Functions Learning Progress Pt.20 How Secure LoRa Communication Devices Work: Building the Future of Private and Long-Range Connectivity Author: Shivam Wakade | Founder, PrivSR How I Rebuilt an RPG Map Editor with Rust, React, and WASM Building a System That Automates YouTube Post-Production Building a 100% Serverless Digital Asset Packager in the Browser Game Recommended AI What is Human-In-The-Loop (HITL)? Deep Dive: React Server Components in TanStack Start Migrating off Google Analytics: Umami vs Plausible vs Fathom Building a Portfolio That Actually Demonstrates Software Engineering Async/Await in JavaScript: From Callbacks to Clean Code (2026) Benchmarking LLM Structured Outputs Angular 21 Multiselect Dropdown: A Migration-Friendly Component with Live Functional Tests ShareBox v5 — GPU transcoding, Netflix-style grid, and why I don't need Plex anymore TOML Schema is live Handling Duplicate Shopify Webhook Events (And Why You Must) Original Kubernetes Dashboard — retired upstream, upgraded to Angular 21. لماذا أسست ترينافو للتجار العرب الذين تتجاهلهم المنصات الغربية Construyendo un recomendador de películas en Python: de los datos al modelo When APIs Lie: A Lesson in Defensive Debugging Pope Leo XIV's AI Encyclical: What Builders Must Know (2026) Donna v0.3.0 HTB — MonitorsFour | Writeup The Free Tool You Trust Is the One You Should Fear the Most HTB — MonitorsFour | Writeup Fr 97. Embeddings and Vector Search: Semantic Search That Works Deep Dive: Building "Gravity Paint" - A Tactile Physics Instrument with React, Matter.js, and p5.js ABAP Unit Testing with Test Doubles and Mocking Frameworks: A Senior Architects Guide to Isolating Dependencies in SAP S/4HANA LeetCode Solution: 5. Longest Palindromic Substring kovax-react 0.8: Tailwind v4 preset, FormField adapters, ColorModeScript, and Storybook I built an AI résumé tool that refuses to lie about your experience The hat Azure Entra ID User & Role Management — Step-by-Step Practical Guide With A Simple Excercise The AI-Native Company: How a Single Founder Can Build Global Organizations Powered by AWS and an Ecosystem of Artificial Intelligences Building a Lightweight Remote MCP Knowledge Base on Cloudflare Workers Why I built Trinavo for the MENA merchants Western platforms ignore The N+1 Query That Killed Our Database, And How I Fixed It Docstrings vs Markdown Docs: What Should Developers Actually Write? Training Data Provenance: The Manifest Diff That Explains the Hash Add SVGIcons MCP to Claude Code and Find SVG Icons from Your Terminal 3 CLI Tools You Can Buy with Crypto — No KYC, No Subscriptions COSS Weekly: OpenClaw competitor NanoClaw Raises $12M, Dust Raises $40M, Sonar Acquires Gitar, and more How to know if you actually need mobile proxies (without buying any) Building Cursor for Community: A Buildathon Built on Time Pressure How we built a PII masking layer for LLM APIs — local detection, reversible tokens, one line to integrate Why MLFQ Was Way Ahead of Its Time Add Runtime Limits to Claude Agent Workflows I Built a Prompt Injection Detector with 98% Recall on Unseen Attacks. Here's Why Data Beat Architecture. 8 Vite Config Options Every Developer Should Know (Vite 8) Feature Flags That Forgot to Leave Why Trust Infrastructure Is Becoming the Hidden Layer of Donation Platforms XyPriss: Rethinking Core Performance and Zero-Trust Architecture in Modern Backends Designing Configuration for Scalable Treasure Hunts SSH Login Delays: The 10-Second Wait That Drives Us Crazy Building Production Multi-Agent Workflows in n8n: What 50 Deployments Taught Us A 3-layer memory system that gives Claude Code persistent context across sessions. Trishul SNMP Suite 2.0.1: Better MIBs, Traps, and SNMP Labs How I built a production AI SaaS as a solo developer Auto-labelling 1.2M robotics frames with VLMs: a failover story India’s Laws Were Not Built for AI — And Courts Are Filling the Gap skill-insp: A Skill That Scores Other Skills Clprolf Minimalist Messaging in the Age of AI What's actually in a good .cursorrules file? I built 10 of them — here's what I learned Building Strong Python Basics – Loops, Functions and Logic
The Request/Response Cycle, HTTP, Auth, JWT, OAuth & Sessions — Explained Properly
Chinwuba · 2026-05-26 · via DEV Community

Most developers learn backend development backwards.

They start with frameworks like Express.js, Next.js, or Django and only later realize they never actually understood what was happening underneath.

That’s why so many developers can build features but struggle to debug authentication issues, CORS problems, cookies, caching, or weird API behavior.

Everything on the web comes down to one thing:

A client sends a request.
A server sends a response.

That’s the entire internet.

But the details inside that cycle are what separate beginners from engineers who deeply understand systems.

The Request/Response Cycle

Imagine you type:

google.com

into your browser and hit Enter.

What happens next?

A lot more than most people think.

Step 1 — DNS Resolution

Your browser does not know where google.com lives.

It asks a DNS server:

“What IP address belongs to google.com?”

DNS responds with something like:

142.250.184.46

DNS is basically the internet’s phonebook.

Humans remember names.
Computers communicate with IP addresses.

Without DNS, we would all be typing raw IP addresses into browsers.

Step 2 — TCP Handshake

Before HTTP even begins, the browser and server establish a connection.

This happens using a TCP three-way handshake:

Client → SYN
Server → SYN-ACK
Client → ACK

This basically means:

“I want to connect.”
“Okay, I’m ready.”
“Great, let’s communicate.”

This setup takes time.

That’s why the first request to a server is slower than later requests.

Step 3 — TLS Handshake (HTTPS)

If the site uses HTTPS — which most modern websites do — another handshake happens.

Now the browser and server negotiate:

encryption algorithms
security certificates
encryption keys

This is what keeps your passwords, messages, and payment information secure while traveling across the internet.

Without HTTPS, anyone on the network could potentially read your traffic.

Step 4 — The HTTP Request

Now the browser finally sends the actual request.

A real request literally looks like this:

GET / HTTP/1.1
Host: google.com
Accept: text/html
User-Agent: Mozilla/5.0

That’s it.

Plain text.

HTTP is just structured text sent over a network connection.

Step 5 — The Server Processes the Request

The server receives the request and decides what to do.

Maybe it:

queries a database
authenticates a user
processes business logic
generates HTML
fetches cached data
talks to another API

Then it prepares a response.

Step 6 — The Response Comes Back

A response looks like this:

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 48523

<!DOCTYPE html>
...

A response contains:

Status line
Headers
Blank line
Body

Every API response you’ve ever worked with follows this pattern.

Step 7 — The Browser Fires More Requests

The HTML might reference:

CSS files
JavaScript bundles
fonts
images
videos

Each one triggers additional requests.

A single page load can easily generate 50–100 requests.

This is why:

caching matters
CDNs matter
bundling matters
HTTP/2 matters
performance optimization matters

Every request has overhead.

HTTP Methods Explained Properly

Methods are the verbs of HTTP.

The URL is the noun.

Together they form a sentence.

GET

Retrieves data.

GET /users/42

Rules:

should not change server state
should be safe
should be idempotent

Calling it 10 times should behave the same as calling it once.

GET requests are aggressively cached by browsers.

POST

Creates data or triggers an action.

POST /users

POST requests usually contain a body:

{
"name": "Jeffrey"
}

POST is not idempotent.

Submitting the same form twice may create two records or send two emails.

PUT

Full replacement update.

If a resource has 10 fields and you PUT it, you send all 10.

Missing fields may get erased.

PATCH

Partial update.

Only send the fields that changed.

Most modern APIs prefer PATCH over PUT.

DELETE

Deletes a resource.

DELETE /users/42

Usually idempotent.

Deleting something twice should not crash the server.

HEAD

Like GET, but returns headers only.

Useful for:

checking file existence
checking last modified dates
validating caches

without downloading the body.

OPTIONS

Asks:

“What methods are allowed here?”

Browsers use this heavily during CORS preflight requests.

Status Codes — What They Actually Mean
2xx — Success
200 OK

Standard success.

201 Created

Something new was created.

Usually returned after POST.

204 No Content

Success with no response body.

Very common for DELETE operations.

3xx — Redirects
301 Moved Permanently

Permanent redirect.

Search engines update their records.

302 Found

Temporary redirect.

304 Not Modified

Used for caching.

Server tells the browser:

“Use your cached version.”

No response body needed.

4xx — Client Errors
400 Bad Request

Malformed request.

401 Unauthorized

Actually means unauthenticated.

“I don’t know who you are.”

403 Forbidden

Authenticated but not allowed.

“I know who you are, but you can’t do this.”

404 Not Found

Resource does not exist.

409 Conflict

Conflicts with current state.

Example:

duplicate email during signup
422 Unprocessable Entity

Valid syntax, invalid data.

429 Too Many Requests

Rate limiting.

5xx — Server Errors
500 Internal Server Error

Generic server crash.

502 Bad Gateway

Proxy received an invalid response upstream.

503 Service Unavailable

Server overloaded or under maintenance.

504 Gateway Timeout

Upstream server took too long to respond.

The Most Important Debugging Skill

Remember this rule:

4xx = fix the request
5xx = fix the server

That mental model alone saves developers hours.

Headers — The Hidden Metadata

Headers are key-value pairs.

They carry metadata about requests and responses.

Important Request Headers
Authorization

Used for authentication.

Two common formats:

Authorization: Basic base64(username:password)

and

Authorization: Bearer

Bearer tokens are heavily used in modern APIs.

Content-Type

Tells the server how to parse the body.

Examples:

application/json
multipart/form-data
application/x-www-form-urlencoded

If this header is wrong, your backend may fail to parse incoming data.

Cookie

Sends stored cookies to the server.

This powers traditional session authentication.

Important Response Headers
Set-Cookie

Tells the browser to store a cookie.

Cache-Control

Controls caching behavior.

Examples:

no-store
max-age=3600
public
private

Caching is one of the biggest performance optimizations on the web.

Access-Control-Allow-Origin

The famous CORS header.

Without it, browsers block cross-origin responses.

CORS — Why Every Developer Eventually Suffers

CORS confuses almost everyone initially.

Here’s the core idea:

Browsers enforce a Same-Origin Policy.

JavaScript running on:




cannot freely read responses from:



```api.otherdomain.com```



without permission.

Why?

Security.

Otherwise malicious websites could silently read sensitive data from sites where you’re logged in.

**How CORS Works**

When your frontend calls another origin, the browser may first send:

OPTIONS /api/users

This is called a preflight request.

The server must respond with headers like:

Access-Control-Allow-Origin: https://velto.io
Access-Control-Allow-Methods: GET, POST, PATCH
Access-Control-Allow-Headers: Authorization, Content-Type

If those headers are missing:

the request may still succeed
the server may still respond
but the browser blocks JavaScript from reading the response

That’s why CORS errors feel confusing.

It’s not usually the backend failing.

It’s the browser enforcing security rules.

**Authentication — The Real Problem It Solves**

HTTP is stateless.

The server forgets you after every request.

Authentication solves that memory problem.

There are three major approaches:

Sessions
JWT
OAuth

**Sessions — The Traditional Approach**

Sessions work like coat-check tickets.

You log in once.

The server creates a session record:

session_id → user_id

Then the server gives your browser a cookie:

Set-Cookie: sessionId=abc123

Your browser automatically sends it back later:

Cookie: sessionId=abc123

The server checks its session store and identifies you.

Why Sessions Are Still Great

Advantages:

instant logout
easy invalidation
simple security model
works naturally with browsers

Disadvantages:

server must store session state
scaling requires shared storage like Redis

But honestly?

For many applications, sessions are still the best option.

**JWT — JSON Web Tokens**

JWTs use a different philosophy.

Instead of storing session state on the server, the client carries signed identity data.

A JWT contains payload data like:

{
  "sub": "42",
  "role": "admin",
  "exp": 1716716400
}

The server signs it cryptographically.

Clients send it like:

Authorization: Bearer <token>

The server verifies the signature and trusts the contents.

No database lookup required.

The Big JWT Tradeoff

JWTs are stateless.

That’s their strength.

And their weakness.

If a JWT gets stolen, it stays valid until expiration.

You cannot instantly invalidate it unless you maintain some server-side blacklist.

This is why modern systems use:

short-lived access tokens
long-lived refresh tokens
Where Should JWTs Be Stored?
localStorage

Easy.

But vulnerable to XSS attacks.

httpOnly Cookies

Much safer.

JavaScript cannot read them.

Preferred for many web apps.

Memory

Most secure.

But disappears on refresh.

**Sessions vs JWT**

Use sessions when:

building traditional web apps
you need instant logout
security matters heavily

Use JWT when:

multiple services need auth
mobile apps consume your API
microservices need shared identity verification

Most applications do not need ultra-complex auth architecture.

Simplicity is often more secure.

**OAuth — “Login with Google”**

OAuth lets third parties authenticate users without sharing passwords.

When users click:

“Continue with Google”

your app never sees their Google password.

Google handles authentication.

Your app only receives trusted identity information.

Simplified OAuth Flow
User clicks login with Google
Redirect to Google
User logs in
Google asks permission
Google redirects back with a code
Your server exchanges the code for tokens
Your app logs the user in

The critical detail:

The token exchange happens server-to-server.

Not directly in the browser.

That prevents token leakage.

Password Storage — Never Store Plain Passwords

Passwords should always be hashed.

Use:

bcrypt
Argon2
scrypt

These are intentionally slow algorithms designed to resist brute-force attacks.

Never store raw passwords.

Ever.

The Full Modern Auth Flow

A modern app usually looks like this:

Registration
hash password
store user
issue session/token
Login
verify credentials
issue authentication
Authenticated Requests
client sends token/cookie
server validates identity
Token Refresh
expired access token replaced using refresh token
Logout
destroy session or invalidate refresh token
Password Reset
issue single-use time-limited reset token
email user
invalidate token after use
Final Thought

Frameworks change constantly.

Protocols last decades.

If you deeply understand:

HTTP
request/response cycles
headers
status codes
cookies
sessions
JWT
OAuth
CORS

then every backend framework becomes dramatically easier to learn.

Because underneath all the abstractions, the internet is still just:

A client sending text to a server.
A server sending text back.

Everything else is layers on top of that foundation.

Enter fullscreen mode Exit fullscreen mode