DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

6 HTTP Security Headers to Add—and How to Configure Them Safely

A practical guide to CSP, HSTS, nosniff, framing, referrer, and browser-feature policies—with deployment checks to help avoid breaking a site.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Six response headers cover different browser behaviors: Content-Security-Policy (CSP) controls which resources a page can load; Strict-Transport-Security (HSTS) tells browsers to use HTTPS; X-Content-Type-Options prevents MIME sniffing; X-Frame-Options limits framing; Referrer-Policy controls referrer details; and Permissions-Policy restricts browser features. They are not interchangeable, and a header that is misconfigured can break legitimate site behavior. Add them at the response layer you control—such as your application, web server, CDN, or reverse proxy—and verify the resulting responses.

Which headers should you add?

Header What it controls Key deployment consideration
Content-Security-Policy Resources and document behaviors, including scripts, styles, and which sites may frame a page. Must reflect the resources and integrations your site actually uses; test before enforcing.
Strict-Transport-Security Whether browsers use HTTPS for the site. Only serve it after HTTPS is correctly configured for the intended scope.
X-Content-Type-Options Whether browsers respect declared MIME types instead of trying to infer them. Set correct Content-Type values for served resources.
X-Frame-Options Whether the page may appear in a frame, iframe, embed, or object. Choose a setting compatible with legitimate embedding.
Referrer-Policy How much referrer URL information accompanies requests. Consider whether application flows depend on detailed referrer data.
Permissions-Policy Which browser features a document and embedded frames may use. Check current browser support and coordinate policy with iframe requirements.

For a concise overview of these headers and their roles, see MDN’s HTTP headers reference.

As an Amazon Associate I earn from qualifying purchases.

How to deploy and verify the headers

  1. Choose the response layer. Configure headers in the application, server, hosting control panel, CDN, or reverse proxy that sends the relevant responses. If more than one layer can modify headers, check the final response rather than assuming a setting took effect.
  2. Set policy based on actual behavior. Inventory the resources the site loads, the pages that must be embeddable, and browser features used by the site and its frames. Avoid copying a policy without adapting it.
  3. Inspect responses. Check important pages, redirects, and resource types to confirm the expected headers appear where intended. A setting applied to one response may not cover every route or asset.
  4. Exercise real site flows. Test scripts, styles, API calls, embeds, and other integrations after changes. Correct a policy or resource configuration when a legitimate feature stops working.
  5. Recheck after infrastructure changes. Hosting, CDN, reverse-proxy, framework, or third-party integration changes can affect response headers and policy requirements.

1. Content-Security-Policy: limit what a page can load

CSP lets site administrators control which resources a browser may load and can help guard against cross-site scripting. Directives govern different behaviors: default-src provides a fallback for fetch directives, script-src controls script sources, base-uri restricts URLs used by a document’s <base> element, and frame-ancestors controls which parents may embed the page. See MDN’s CSP reference for directive behavior and report-only mode.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build and test a policy

First identify the scripts, styles, images, fonts, APIs, and frames the site needs. Then define directives that permit those sources and deny what the site does not need. CSP can be delivered in report-only mode so violations can be observed before a policy is enforced; use that stage to find resources or integrations that an eventual policy would block.

#1 Best Overall
Sale
TP-Link AC1200 WiFi Router Dual Band Wireless Internet Router (Archer A54) | 4 x 10/100 Mbps Fast Ethernet Ports, EasyMesh Compatible, Support Guest WiFi, Access Point Mode, IPv6 & Parental Controls
  • Dual-band Wi-Fi with 5 GHz speeds up to 867 Mbps and 2.4 GHz speeds up to 300 Mbps, delivering 1200 Mbps of total bandwidth¹. Dual-band routers do not support 6 GHz. Performance varies by conditions, distance to devices, and obstacles such as walls.
  • Covers up to 1,000 sq. ft. with four external antennas for stable wireless connections and optimal coverage.
  • Supports IGMP Proxy/Snooping, Bridge and Tag VLAN to optimize IPTV streaming
  • Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home
  • Advanced Security with WPA3 - The latest Wi-Fi security protocol, WPA3, brings new capabilities to improve cybersecurity in personal networks

This is only a starting example, not a universal policy:

Content-Security-Policy: default-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'self'

A real site may need changes for its scripts, styles, APIs, embedded content, or nonce and hash strategy. Do not enforce this example unchanged without checking the site: an overly restrictive policy can break it.

Rank #2
Sale
TP-Link ER605, Wired Gigabit VPN Router
  • 【Five Gigabit Ports】1 Gigabit WAN Port plus 2 Gigabit WAN/LAN Ports plus 2 Gigabit LAN Port. Up to 3 WAN ports optimize bandwidth usage through one device.
  • 【One USB WAN Port】Mobile broadband via 4G/3G modem is supported for WAN backup by connecting to the USB port. For complete list of compatible 4G/3G modems, please visit TP-Link website.
  • 【Abundant Security Features】Advanced firewall policies, DoS defense, IP/MAC/URL filtering, speed test and more security functions protect your network and data.
  • 【Highly Secure VPN】Supports up to 20× LAN-to-LAN IPsec, 16× OpenVPN, 16× L2TP, and 16× PPTP VPN connections.
  • Security - SPI Firewall, VPN Pass through, FTP/H.323/PPTP/SIP/IPsec ALG, DoS Defence, Ping of Death and Local Management. Standards and Protocols IEEE 802.3, 802.3u, 802.3ab, IEEE 802.3x, IEEE 802.1q

2. Strict-Transport-Security: tell browsers to use HTTPS

HSTS tells browsers to use HTTPS instead of HTTP for the site. Serve it only after HTTPS is correctly configured across the scope you intend to protect. Decide whether subdomains should be included and assess domain readiness before pursuing preload. The appropriate duration, subdomain scope, and preload configuration depend on the deployment; do not copy those settings without reviewing that scope.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

See MDN’s HTTP headers reference for the header’s role.

Rank #3
Sale
TP-Link ER7206, Multi-WAN Professional Wired Gigabit VPN Router | Increased Network Capacity, SPI Firewall, Omada SDN Integrated, Load Balance, Lightning Protection
  • 【Flexible Port Configuration】1 Gigabit SFP WAN Port + 1 Gigabit WAN Port + 2 Gigabit WAN/LAN Ports plus1 Gigabit LAN Port. Up to four WAN ports optimize bandwidth usage through one device.
  • 【Increased Network Capacity】Maximum number of associated client devices – 150,000. Maximum number of clients – Up to 700.
  • 【Integrated into Omada SDN】Omada’s Software Defined Networking (SDN) platform integrates network devices including gateways, access points & switches with multiple control options offered – Omada Hardware controller, Omada Software Controller or Omada cloud-based controller(Contact TP-Link for Cloud-Based Controller Plan Details). Standalone mode also applies.
  • 【Cloud Access】Remote Cloud access and Omada app brings centralized cloud management of the whole network from different sites—all controlled from a single interface anywhere, anytime.
  • 【SDN Compatibility】For SDN usage, make sure your devices/controllers are either equipped with or can be upgraded to SDN version. SDN controllers work only with SDN Gateways, Access Points & Switches. Non-SDN controllers work only with non-SDN APs. For devices that are compatible with SDN firmware, please visit TP-Link website.

3. X-Content-Type-Options: stop MIME sniffing

Set X-Content-Type-Options: nosniff so browsers use the declared MIME type rather than infer a different one. In particular, browsers can block script and stylesheet requests whose declared MIME types are unexpected. The header does not fix incorrect metadata: ensure JavaScript, CSS, and other served files have accurate Content-Type values. See MDN’s X-Content-Type-Options reference.

4. X-Frame-Options: control who can frame a page

X-Frame-Options controls whether a browser may render a document in a frame, iframe, embed, or object. It helps defend against unwanted embedding, including clickjacking.

Rank #4
Sale
ASUS RT-AX1800S Dual Band WiFi 6 Extendable Router, Subscription-Free Network Security, Parental Control, Built-in VPN, AiMesh Compatible, Gaming & Streaming, Smart Home
  • New-Gen WiFi Standard – WiFi 6(802.11ax) standard supporting MU-MIMO and OFDMA technology for better efficiency and throughput.Antenna : External antenna x 4. Processor : Dual-core (4 VPE). Power Supply : AC Input : 110V~240V(50~60Hz), DC Output : 12 V with max. 1.5A current.
  • Ultra-fast WiFi Speed – RT-AX1800S supports 1024-QAM for dramatically faster wireless connections
  • Increase Capacity and Efficiency – Supporting not only MU-MIMO but also OFDMA technique to efficiently allocate channels, communicate with multiple devices simultaneously
  • 5 Gigabit ports – One Gigabit WAN port and four Gigabit LAN ports, 10X faster than 100–Base T Ethernet.
  • Commercial-grade Security Anywhere – Protect your home network with AiProtection Classic, powered by Trend Micro. And when away from home, ASUS Instant Guard gives you a one-click secure VPN.
  • DENY blocks framing.
  • SAMEORIGIN permits framing by pages from the same origin.

Choose based on whether embedding is a legitimate feature. For more comprehensive and flexible control, use CSP’s frame-ancestors directive; it can specify permitted framing parents. Preserve required integrations deliberately and test them after rollout. See MDN’s X-Frame-Options reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

5. Referrer-Policy: limit URL information sent with requests

Referrer-Policy controls how much referrer information accompanies requests. When no policy is set or its value is invalid, MDN documents strict-origin-when-cross-origin as the default: same-origin requests retain the URL, cross-origin secure requests receive only the origin, and less-secure destinations receive no referrer.

Best Value
Sale
ASUS RT-BE58U WiFi 7 Router - Dual-WAN, 3.6 Gbps, Mesh + VPN Compatible
  • Beyond-fast WiFi 7 (802.11be) - WiFi 7 (802.11be) dual-band extendable router boosts speeds up to 3600 Mbps, with 4096-QAM increasing a single frequency band’s transmission speed by 1.2 times
  • Unleashing Multi-link operation (MLO) for Ultra-Smooth Connectivity - Link to multiple bands at the same time to ensure stable internet connections and efficient data transfers
  • Versatile WAN configuration options - Establish always-on internet through AI WAN detection and a convenient USB port ready for 4G LTE and 5G Mobile tethering.
  • Smart Home Master - Easily establish up to three SSIDs with Smart Home Master for easy IoT device setup and management, instant VPN connections, and convenient parental controls.
  • Commercial-Grade network security - Network security with commercial-grade AiProtection Pro powered by Trend Micro, plus a one-tap security scan and Safe Browsing.

Setting strict-origin-when-cross-origin explicitly makes the intended behavior clear. Check whether application flows depend on more detailed referrer information. Avoid unsafe-url unless disclosure of full source URLs is intentional, since paths or query strings may contain private information. See MDN’s Referrer-Policy reference.

6. Permissions-Policy: restrict browser features

Permissions-Policy lets a site allow or deny selected browser features in its document and embedded frames. For example, geolocation=() denies geolocation. Feature allowlists and iframe rules determine whether embedded content can use a feature.

List the features the site genuinely uses, deny unused features where appropriate, and align iframe permissions with the parent policy. MDN marks this header as having limited availability, so check current browser support before relying on it in production. See MDN’s Permissions-Policy reference.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Final checks before considering the work done

  • Confirm the headers are present on the responses where you expect them, including relevant redirects and page or resource types.
  • For CSP, observe report-only violations before enforcement and validate required resources after rollout.
  • For nosniff, verify declared MIME types as well as the header.
  • Test legitimate embeds and browser-feature use against the framing and permissions rules.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.