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

推荐订阅源

The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园_首页
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
量子位
Blog — PlanetScale
Blog — PlanetScale
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
阮一峰的网络日志
阮一峰的网络日志
D
Docker
罗磊的独立博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
云风的 BLOG
云风的 BLOG
IT之家
IT之家
MyScale Blog
MyScale Blog
Microsoft Azure Blog
Microsoft Azure Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I Built a Browser-Only HTTP Header Analyzer — Security Sc...
Dev Nestio · 2026-06-28 · via DEV Community

Dev Nestio

Every web developer has had this moment: you check your app's response headers, see a wall of Content-Type and Cache-Control, and wonder — is this actually secure? Which headers am I missing? What does Permissions-Policy do again?

I built HTTP Header Analyzer to answer those questions instantly. Paste any set of HTTP response headers and get a security score, missing header warnings, cache analysis, and recommended values — all in the browser, zero dependencies, zero server.


What it does

Paste headers in Key: Value format (one per line) and click Analyze Headers. The tool:

  • Scores security headers from 0–100 with a letter grade (A+ → F)
  • Flags missing critical headers with recommended values
  • Categorizes all headers — Security / Cache / Content / Other
  • Evaluates each header value — good, warn, or bad — with a plain-English explanation
  • Supports sample presets for Nginx, Express, Apache, and a "Minimal (insecure)" set

The security scoring model

Six headers are required; three more earn bonus points:

Header Points
Content-Security-Policy 20
Strict-Transport-Security 15
X-Frame-Options 10
X-Content-Type-Options 10
Referrer-Policy 10
Permissions-Policy 10
Cross-Origin-Embedder-Policy +5 bonus
Cross-Origin-Opener-Policy +5 bonus
Cross-Origin-Resource-Policy +5 bonus

A "warn" rating (e.g. HSTS with max-age under a year, or CSP with unsafe-inline) earns half points. The score caps at 100.

A+ ≥ 90   A ≥ 80   B ≥ 70   C ≥ 60   D ≥ 40   F < 40


Nuanced per-header evaluation

Rather than just checking "present or absent," the tool evaluates the value:

HSTS

Strict-Transport-Security: max-age=86400
→ warn: max-age should be at least 31536000 (1 year)

Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
→ good: Good configuration.

CSP

Content-Security-Policy: default-src 'self'; script-src 'unsafe-inline'
→ warn: Contains unsafe-inline. Consider removing for stronger XSS protection.

Content-Security-Policy: default-src 'self'; object-src 'none'
→ good: Policy present without unsafe directives.

Set-Cookie

Set-Cookie: session=abc123; path=/
→ bad: Missing HttpOnly; Missing Secure; Missing SameSite.

Set-Cookie: session=abc123; HttpOnly; Secure; SameSite=Strict
→ good: All security attributes present.

Server / X-Powered-By — version disclosure is flagged:

Server: nginx/1.24.0
→ warn: Version disclosed. Consider removing version number.

Server: nginx
→ good: No version disclosed.

Cache-Control — directives are decoded into plain English:

Cache-Control: public, max-age=31536000, immutable
→ public | max-age=31536000 | immutable: resource will not change


Sample presets

Three real-world samples are one click away:

Nginx — full security headers, Brotli, ETag, HSTS with preload

Express — X-Powered-By leak, weak HSTS, CORS origin, signed cookie

Apache — version disclosure, no security headers, basic cache

Minimal (insecure) — the bad old days: PHPSESSID without HttpOnly, PHP version disclosed

Load "Minimal (insecure)" and you get an F-grade report with every critical header flagged as missing. Load "Nginx" and you score 75 with specific advice on adding COEP/COOP/CORP to push toward A+.


Implementation

Zero dependencies. Pure HTML + CSS + vanilla JavaScript in a single file.

The parser handles:

  • HTTP status lines (skipped correctly)
  • Multiple Set-Cookie headers (collected as an array)
  • Values containing colons (Location: https://example.com:443/path)
  • Case-insensitive header name matching
function parseHeaders(raw) {
  const headers = {};
  for (const line of raw.split("\n")) {
    const trimmed = line.trim();
    if (!trimmed || /^HTTP\/\d/i.test(trimmed)) continue;
    const idx = trimmed.indexOf(":");
    if (idx === -1) continue;
    const key = trimmed.slice(0, idx).trim().toLowerCase();
    const value = trimmed.slice(idx + 1).trim();
    if (key === "set-cookie") {
      if (!headers[key]) headers[key] = [];
      headers[key].push({ name: trimmed.slice(0, idx).trim(), value });
    } else {
      headers[key] = { name: trimmed.slice(0, idx).trim(), value };
    }
  }
  return headers;
}

Scoring:

function computeScore(parsedHeaders) {
  let score = 0;
  for (const key of REQUIRED_SECURITY_HEADERS) {
    const hdr = parsedHeaders[key];
    if (!hdr) continue;
    const ev = HEADER_DB[key].evaluate(hdr.value);
    if (ev.rating === "good") score += HEADER_DB[key].points;
    else if (ev.rating === "warn") score += Math.floor(HEADER_DB[key].points * 0.5);
  }
  // bonus for COEP/COOP/CORP
  return Math.min(100, score + bonusScore);
}


147 tests, no framework

Tests run in Node.js with just the built-in assert module.

$ node test/test.js

Results: 147 passed, 0 failed
Total: 147 tests

Test coverage includes:

  • Parser edge cases (status line skipping, colon-in-value, multiple Set-Cookie)
  • Each header's evaluation logic across all rating outcomes
  • Score computation (correct points, half-points for warn, bonus capping at 100)
  • Grade thresholds (A+ / A / B / C / D / F)
  • Utility functions (formatSeconds, formatBytes)
  • Integration scenarios (nginx sample, minimal insecure, full perfect score)

Try it

Live tool: https://devnestio.pages.dev/http-header-analyzer/

All tools: https://devnestio.pages.dev/

The tool is part of devnestio — a collection of browser-only developer utilities with no login, no tracking, and no server round-trips.


Built with vanilla JS. 147 tests. Zero dependencies.