HTTP Common Headers Reference Cheatsheet 2026
Complete guide to standard and security HTTP headers including Authorization, CORS control, caching policies, and CSP directives.
Interactive Skill Mastery
Mark commands as learned to build your customized reference tracker. Retained locally in this browser.
Request Headers
When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Content-Type: application/jsonOutput Example
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Accept: application/json, text/plainOutput Example
HTTP/1.1 200 OK
Accept: application/json, text/plain
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
User-Agent: Mozilla/5.0 (Windows NT...)Output Example
HTTP/1.1 200 OK
User-Agent: Mozilla/5.0 (Windows NT...)
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Accept-Language: en-US, en;q=0.9Output Example
HTTP/1.1 200 OK
Accept-Language: en-US, en;q=0.9
Cache-Control: private
Content-Length: 412Response Headers
When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Server: Apache/2.4.41 (Ubuntu)Output Example
HTTP/1.1 200 OK
Server: Apache/2.4.41 (Ubuntu)
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Location: https://example.com/new-pageOutput Example
HTTP/1.1 200 OK
Location: https://example.com/new-page
Cache-Control: private
Content-Length: 412CORS
When to Use
When configuring Cross-Origin Resource Sharing (CORS) rules to secure or grant cross-domain client requests.
Common Mistakes
Using '*' wildcard in Access-Control-Allow-Origin in production alongside credentials, which is disallowed and breaks requests.
Shortcut / Pro-Tip
Set specific origin domains (e.g. https://www.learnhubly.com) to maintain absolute security.Example
Access-Control-Allow-Origin: *Output Example
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Cache-Control: private
Content-Length: 412When to Use
When configuring Cross-Origin Resource Sharing (CORS) rules to secure or grant cross-domain client requests.
Common Mistakes
Using '*' wildcard in Access-Control-Allow-Origin in production alongside credentials, which is disallowed and breaks requests.
Shortcut / Pro-Tip
Set specific origin domains (e.g. https://www.learnhubly.com) to maintain absolute security.Example
Access-Control-Allow-Methods: GET, POST, OPTIONSOutput Example
HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, POST, OPTIONS
Cache-Control: private
Content-Length: 412When to Use
When configuring Cross-Origin Resource Sharing (CORS) rules to secure or grant cross-domain client requests.
Common Mistakes
Using '*' wildcard in Access-Control-Allow-Origin in production alongside credentials, which is disallowed and breaks requests.
Shortcut / Pro-Tip
Set specific origin domains (e.g. https://www.learnhubly.com) to maintain absolute security.Example
Access-Control-Allow-Headers: Content-Type, AuthorizationOutput Example
HTTP/1.1 200 OK
Access-Control-Allow-Headers: Content-Type, Authorization
Cache-Control: private
Content-Length: 412When to Use
When configuring Cross-Origin Resource Sharing (CORS) rules to secure or grant cross-domain client requests.
Common Mistakes
Using '*' wildcard in Access-Control-Allow-Origin in production alongside credentials, which is disallowed and breaks requests.
Shortcut / Pro-Tip
Set specific origin domains (e.g. https://www.learnhubly.com) to maintain absolute security.Example
Access-Control-Max-Age: 86400Output Example
HTTP/1.1 200 OK
Access-Control-Max-Age: 86400
Cache-Control: private
Content-Length: 412Security
When to Use
When strengthening the browser security shield of your application, preventing scripts sniffs, clickjack, or XSS.
Common Mistakes
Applying an overly strict Content-Security-Policy (CSP) that inadvertently blocks essential third-party scripts or Google analytics.
Shortcut / Pro-Tip
Use 'Content-Security-Policy-Report-Only' first to audit policies in production before enforcing them.Example
Strict-Transport-Security: max-age=31536000; includeSubDomainsOutput Example
HTTP/1.1 200 OK
Strict-Transport-Security: max-age=31536000; includeSubDomains
Cache-Control: private
Content-Length: 412When to Use
When strengthening the browser security shield of your application, preventing scripts sniffs, clickjack, or XSS.
Common Mistakes
Applying an overly strict Content-Security-Policy (CSP) that inadvertently blocks essential third-party scripts or Google analytics.
Shortcut / Pro-Tip
Use 'Content-Security-Policy-Report-Only' first to audit policies in production before enforcing them.Example
Content-Security-Policy: default-src 'self' https://api.example.comOutput Example
HTTP/1.1 200 OK
Content-Security-Policy: default-src 'self' https://api.example.com
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
X-Frame-Options: DENYOutput Example
HTTP/1.1 200 OK
X-Frame-Options: DENY
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
X-Content-Type-Options: nosniffOutput Example
HTTP/1.1 200 OK
X-Content-Type-Options: nosniff
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Referrer-Policy: strict-origin-when-cross-originOutput Example
HTTP/1.1 200 OK
Referrer-Policy: strict-origin-when-cross-origin
Cache-Control: private
Content-Length: 412Caching
When to Use
When defining server and browser caching strategies to optimize web asset deliveries.
Common Mistakes
Caching sensitive private API user data inside shared CDN proxies.
Shortcut / Pro-Tip
Use 'immutable' for versioned bundles (like main.12a5f.js) to tell browsers to cache them forever.Example
Cache-Control: public, max-age=31536000, immutableOutput Example
HTTP/1.1 200 OK
Cache-Control: public, max-age=31536000, immutable
Cache-Control: private
Content-Length: 412When to Use
When defining server and browser caching strategies to optimize web asset deliveries.
Common Mistakes
Caching sensitive private API user data inside shared CDN proxies.
Shortcut / Pro-Tip
Use 'immutable' for versioned bundles (like main.12a5f.js) to tell browsers to cache them forever.Example
Cache-Control: no-store, no-cache, must-revalidateOutput Example
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: private
Content-Length: 412When to Use
When defining server and browser caching strategies to optimize web asset deliveries.
Common Mistakes
Caching sensitive private API user data inside shared CDN proxies.
Shortcut / Pro-Tip
Use 'immutable' for versioned bundles (like main.12a5f.js) to tell browsers to cache them forever.Example
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"Output Example
HTTP/1.1 200 OK
ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
If-None-Match: "33a64df551425fcc..."Output Example
HTTP/1.1 200 OK
If-None-Match: "33a64df551425fcc..."
Cache-Control: private
Content-Length: 412Auth
When to Use
When making secure API requests to a protected backend service that requires an authenticated JSON Web Token (JWT) or OAuth token.
Common Mistakes
Exposing this header in client-side client browser logs or failing to use HTTPS, which allows token sniffing and account takeover.
Shortcut / Pro-Tip
Commonly stored in memory or secure HttpOnly cookies rather than localStorage for enhanced security.Example
fetch('/api/user', {
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
}
});Output Example
HTTP/1.1 200 OK
Content-Type: application/json
{ "id": 42, "name": "Dharmveer" }When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=Output Example
HTTP/1.1 200 OK
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Cookie: session_id=abc123xyzOutput Example
HTTP/1.1 200 OK
Cookie: session_id=abc123xyz
Cache-Control: private
Content-Length: 412When to Use
Include this standard HTTP header in web request/response packets to govern data parsing, authorization, caching, or security.
Common Mistakes
Forgetting HTTP headers are case-insensitive but have strict format parameters that break on punctuation typos.
Shortcut / Pro-Tip
Inspect headers easily via Chrome/Firefox DevTools under Network -> Headers.Example
Set-Cookie: session_id=abc123xyz; Secure; HttpOnly; SameSite=StrictOutput Example
HTTP/1.1 200 OK
Set-Cookie: session_id=abc123xyz; Secure; HttpOnly; SameSite=Strict
Cache-Control: private
Content-Length: 412HTTP Headers Best Practices
1Implement Strict Caching Rules
Use Cache-Control headers with long max-age and 'immutable' for static assets, and 'no-store' for private or dynamic JSON API responses.
2Enforce Secure HTTPS Redirection
Set the Strict-Transport-Security (HSTS) header to force browsers to interact with your site exclusively over secure HTTPS.
3Block Clickjacking with X-Frame-Options
Set X-Frame-Options to DENY or SAMEORIGIN to prevent malicious frames from rendering your web layouts.
4Configure Content Security Policy (CSP)
Define explicit source origins for scripts, styles, and image connections to mitigate cross-site scripting (XSS) threats.
5Restrict CORS Origin Policies
In production APIs, always set Access-Control-Allow-Origin to specific trusted domains instead of a general '*' wildcard.
Common HTTP Headers Errors & Solutions
CORS Error: No 'Access-Control-Allow-Origin' header is present
The backend server is missing CORS headers. Configure CORS middleware on the server to allow request origins.
Insecure Content Blocked
You are trying to request HTTP APIs from an HTTPS site. Ensure all fetch targets are updated to use secure HTTPS URLs.
The Content-Security-Policy directive blocks script execution
An inline script or external resource violates your CSP rules. Update your CSP header to include the specific domain or script nonce.
Authorization headers stripped
Apache/Nginx proxies sometimes drop Authorization headers. Enable 'PassHeader Authorization' in server proxy configurations.
Browser MIME-type sniffing issues
Supply the header 'X-Content-Type-Options: nosniff' to force browsers to follow your declared Content-Type (e.g. application/javascript).
Common HTTP Headers Interview Questions
Q1What is the purpose of the CORS Access-Control-Allow-Origin header?
It tells the web browser which third-party origins are authorized to read response payloads requested from cross-site scripts.
Q2What is the difference between Cache-Control: no-cache and no-store?
no-store commands the browser and CDN proxies never to cache or save any copy of the response. no-cache allows caching but forces the browser to revalidate with the origin server before serving it.
Q3What does the HTTP Status 401 Unauthorized vs 403 Forbidden represent?
401 Unauthorized means the request lacks valid authentication credentials. 403 Forbidden means the client's identity is authenticated, but they do not possess permissions to access the requested resource.
Q4What does the Content-Security-Policy (CSP) header protect against?
CSP protects websites from cross-site scripting (XSS), clickjacking, and injection attacks by restricting which sources can load and execute scripts or media.
Q5How do HTTP Cookies manage session states securely using headers?
The server returns a 'Set-Cookie' header containing security directives: 'Secure' (force HTTPS), 'HttpOnly' (block JavaScript accessibility), and 'SameSite=Strict' (block CSRF attacks).
Related Resources
HTTP Status Codes Decision Tree
An expert decision flow chart to choosing the correct HTTP status codes in APIs.
REST API Complete Guide 2026
Master resource design, caching headers, error patterns, and API architecture.
REST API Tester
Send custom HTTP queries and inspect both response body and raw headers in real-time.
RFC 9457 Problem Details Guide
Standardize error reporting formats using the modern RFC 9457 specifications.
Generated from LearnHubly Developer Cheatsheets
Access interactive sandbox tests, tools, and developer code bases at https://www.learnhubly.com