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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A 400 response in an Nginx–Varnish stack is usually caused by a malformed request, a missing or invalid Host header, a PROXY-protocol or TLS framing mismatch, or a request header that exceeds the limit at one of the two hops. Do not raise every buffer first. Identify which process emitted the response, inspect the rejected request, remove unnecessary header data, and then increase only the specific limit that legitimate traffic needs.

Start by finding the hop that generated the 400

The public URL alone does not tell you whether Nginx or Varnish rejected the request. A client can receive the same status code even though the two servers use different parsers, limits and logs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Capture the public response. Record the status, response headers, response body, timestamp and any request or trace ID. A verbose HTTP client is useful for seeing the connection and protocol in use, for example curl -sv --http1.1 https://your-public-host.example/. Redact cookies, authorization values and other secrets before sharing the output.
  2. Query each reachable hop directly. Test the public listener, the Varnish listener and the origin or Nginx listener separately where your topology permits. Use the same method, path and relevant headers so that the failing request is comparable.
  3. Correlate timestamps. Check Nginx access and error logs alongside Varnish Shared Log (VSL) records from varnishlog. If Varnish rejects a client request, its record commonly contains BogoHeader, LostHeader, RespStatus 400 or a related request event. A request that never appears in Nginx logs was probably rejected before Nginx received it.
  4. Repeat with a minimal request. Send a request with one ordinary path, a normal Host, no application cookies and no optional tracing headers. If the minimal request succeeds, add the original headers back in small groups until the offending field or protocol feature is isolated.

Keep the exact software versions and build information with the incident. Nginx defaults and parameter behavior can vary by release and build, and Varnish settings differ between versions and editions.

What a 400 means at each layer

Failure class Likely emitting hop Evidence to look for Corrective direction
Malformed header syntax Varnish or Nginx Varnish BogoHeader; Nginx error log entries about invalid request headers Fix the client, proxy or header-generation code; do not simply enlarge buffers
HTTP/1.1 request without a valid Host Varnish or Nginx Request capture shows a missing, duplicated or malformed Host Correct the client or forwarding proxy so exactly one valid authority is sent
PROXY-protocol framing mismatch The listener expecting PROXY protocol One side is configured for PROXY protocol while its peer sends ordinary HTTP, or the versions do not agree Enable the same PROXY protocol version on both sides, or disable it on both
One oversized request-header field Nginx or Varnish Large Cookie, Authorization or forwarded header; limit-related log message Reduce the field; otherwise raise the one-field limit at the rejecting hop
Total request too large Varnish, Nginx or an upstream proxy Combined headers and request line exceed the configured request-size limit Remove needless data or increase the total request limit narrowly
Too many header lines Varnish or another intermediary Header count approaches the configured maximum Remove duplicate and obsolete fields or raise the count limit only when required

A 400 generated while parsing the client request is different from a 503 generated while parsing a response from the backend. Treat those paths separately; changing client request buffers will not repair an origin response-header failure.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.

Validate HTTP syntax, Host and connection framing

Check the HTTP/1.1 Host header

Varnish documents that it returns HTTP 400 when it sees an HTTP/1.1 request without a Host header. The field must also be syntactically valid for the authority being requested. Inspect the request as it arrives at Varnish, not only the headers that an application eventually sees.

  • Make sure the client sends exactly one Host field for HTTP/1.1.
  • Check that an upstream proxy is not deleting the field, adding a second one, or forwarding an empty value.
  • Verify that a health check, synthetic monitor or custom script is not using HTTP/1.0-style requests against an HTTP/1.1-only path.
  • For a TLS request, confirm that the authority used for certificate selection and routing is the intended host; do not substitute an unrelated internal hostname when testing.

Confirm PROXY protocol agreement

PROXY protocol carries client-connection metadata before the HTTP request. A listener configured to expect that preface cannot parse an ordinary HTTP request as valid framing. The reverse mismatch is also bad: a listener that expects HTTP will see the PROXY preface as invalid bytes. Check both ends of every connection—client to Varnish, Varnish to Nginx, or a load balancer to Varnish—and confirm that the configured version is the one the peer actually sends.

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

Make sure TLS is terminated at the intended hop

Sending plain HTTP to a TLS-only listener, or encrypted TLS bytes to a listener expecting clear-text HTTP, can produce a parsing error that looks like an application problem. Draw the connection sequence and mark where TLS terminates. Then test each hop with the correct scheme and port. A request that works when sent directly to the TLS terminator but fails on the next clear-text hop points to forwarding or protocol configuration rather than a cookie-size limit.

Look for illegal header characters and continuation lines

Varnish uses BogoHeader diagnostics for malformed headers such as illegal whitespace, control characters, missing names and invalid continuation lines. Inspect the raw request generated by the client and every proxy that rewrites it. Common sources include hand-built HTTP clients, concatenated header values, duplicated separators and middleware that appends a second forwarded-header chain without normalizing the first.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

Understand Nginx request-header limits

The NGINX core documentation states that a request-header field must fit inside one large_client_header_buffers buffer; if an individual field is larger than one buffer, Nginx returns 400. The documented default is four buffers of 8 KB each. That is a per-field rule, not a promise that four buffers combine to permit a 32 KB cookie.

Directive What it controls Important diagnostic detail
client_header_buffer_size Initial buffer used while reading request headers Changing it alone does not make a long individual field fit if the large-buffer rule is still exceeded
large_client_header_buffers number size Number and size of buffers available for large request lines and header fields One request-header field must fit in one size buffer; increasing number alone does not lengthen a permitted line

The request line has a related but different failure: when it exceeds one large buffer, Nginx commonly returns 414 (Request-URI Too Large), whereas an individual request-header field that exceeds one buffer produces 400. This distinction helps you decide whether to inspect a long URL or a long header such as Cookie.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Find the offending field

  • Cookie: stale session, consent, experiment and shopping-cart cookies can accumulate across subdomains. Compare the total cookie string and each cookie value, then expire obsolete names at the application.
  • Authorization: oversized bearer or signed tokens may exceed a single field buffer. Prefer shorter-lived, compact claims or a server-side session reference when your authentication design allows it.
  • X-Forwarded-* and tracing fields: repeated proxy hops can append long address, host, port and trace chains. Normalize them at a trusted boundary and remove duplicate entries.
  • Custom application fields: inspect generated JSON-in-header, feature flags and debugging metadata. Headers are a poor place for large payloads; move substantial data into a request body or server-side state when the protocol and application permit.

Inspect Varnish limits and VSL evidence

Varnish checks both the shape and the size of the client request. The Varnish Cache varnishd reference documents these defaults:

Parameter Documented default Meaning
http_max_hdr 64 header lines Maximum number of request-header lines Varnish accepts
http_req_hdr_len 8 KB Maximum length of an individual request-header field
http_req_size 32 KB Maximum size of the complete request, including the request line and headers as Varnish parses them
h2_max_header_list_size Version/configuration dependent; inspect the installed HTTP/2 settings Limit applied to the decoded HTTP/2 header list

Use VSL to distinguish these cases rather than guessing from the browser’s generic error page. A header-length or request-size rejection points to a limit or excessive data. BogoHeader and LostHeader point toward malformed or discarded fields. For HTTP/2, investigate the configured header-list limit when the VSL record identifies a header-list overflow.

Rank #3
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Varnish’s troubleshooting guidance warns that larger limits consume workspace and memory and do not guarantee flawless operation. A higher ceiling can expose downstream limits, increase per-connection resource use and make abusive requests more expensive to process. Change one parameter at a time, document the reason and observe memory and rejection rates after the reload or restart.

Remove unnecessary request data before raising limits

Request cleanup is safer than making every component accept arbitrarily large headers. Start at the source that creates the data and work toward the public edge.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Capture names and lengths, not secret values. Log the header name, byte length and source hop. Keep authorization and cookie contents redacted.
  2. Delete stale cookies. Expire old application versions, duplicate tracking names and abandoned experiments. Set appropriate domain and path scopes so a cookie is not sent to unrelated hosts.
  3. Collapse forwarded chains. At a trusted proxy, rebuild X-Forwarded-For, X-Forwarded-Host and related fields from known connection data instead of blindly appending unbounded values.
  4. Reduce token and tracing overhead. Remove debug baggage in production, shorten unnecessary trace baggage and avoid copying the same identifier into several custom fields.
  5. Fix malformed emitters. Correct code that creates empty names, illegal control bytes, invalid whitespace or broken continuation lines. A larger buffer cannot make invalid syntax valid.
  6. Retest the original request. Preserve a safe reproduction of the failing header lengths so that cleanup can be verified and regression-tested.

Apply a narrow Nginx change when the traffic is legitimate

Only change Nginx after logs or a direct-hop test show that Nginx is the rejecting parser and the request is valid. Place the directive at the narrowest appropriate http or server scope. For example:

http {
    client_header_buffer_size 4k;
    large_client_header_buffers 4 16k;

    server {
        listen 80;
        # proxy_pass and normal Varnish routing here
    }
}

This example raises the size of each large buffer to 16 KB while retaining four buffers; it is not a universal recommendation. Select a value from the measured maximum field length plus reasonable protocol overhead, and leave headroom for normal variation. If one cookie is 20 KB, four 16 KB buffers still cannot accept it because the field must fit in one buffer.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
  1. Measure the largest legitimate individual field and the total request at the rejecting hop.
  2. Change only the relevant Nginx context. Avoid a global increase when one virtual server or endpoint needs the exception.
  3. Run nginx -t and stop if configuration validation fails.
  4. Reload through your normal change-control procedure, preserving the previous configuration for rollback.
  5. Replay the exact failing request and a minimal control request. Check Nginx logs, Varnish VSL and memory behavior.

Increasing the number of buffers can help Nginx hold more separate large fields, but it does not make an individual field longer. If the error is caused by a huge cookie, reduce that cookie or increase the buffer size at the field-rejecting server—not merely the buffer count.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Apply a narrow Varnish change when VSL proves its limit

Varnish parameters are supplied through the startup command or the service configuration used by your installed release. A representative configuration is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
-p http_max_hdr=96
-p http_req_hdr_len=16k
-p http_req_size=64k

These values are examples of syntax, not safe defaults for every site. Use the smallest change supported by measured traffic: raise http_req_hdr_len for one valid long field, http_req_size for a valid but large aggregate request, or http_max_hdr for a high count of legitimate fields. For HTTP/2, adjust the configured header-list limit only when the VSL evidence identifies that condition.

  1. Confirm the installed Varnish version, edition and current parameter values.
  2. Identify whether the rejection is per-field, aggregate-size, count or HTTP/2 header-list related.
  3. Remove needless request data first, then select the one parameter that remains too restrictive.
  4. Update the service or startup configuration, validate it using the deployment procedure for that installation and restart or reload as required.
  5. Monitor VSL for the original rejection markers, backend reachability and memory/workspace pressure.

Do not raise all three limits together merely because a 400 occurred. Larger workspaces can increase memory consumption, and accepting a request at Varnish may simply move the failure to Nginx or the origin.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

HTTP/2-specific checks

HTTP/2 transmits a compressed header list rather than the textual HTTP/1.1 lines you see in a basic packet capture. A client can therefore pass an HTTP/1.1 test while an HTTP/2 request is rejected for its decoded header-list size. Compare the protocol explicitly, for example by testing with and without --http2 where your client supports it, and inspect VSL for the HTTP/2 limit named by the installed version. The remedy is still the same sequence: remove excess headers, verify the emitting hop, then raise only the documented HTTP/2 limit if valid traffic requires it.

Use a troubleshooting matrix instead of changing everything

Observation Most useful next check Likely fix
Varnish VSL shows BogoHeader and no Nginx request Raw request syntax, Host, control characters and continuation lines Fix the client or preceding proxy
Only requests with a large cookie fail Measure that one field at Varnish and Nginx Expire or reduce cookies; otherwise raise the per-field limit at the first rejecting hop
Many ordinary fields cause failure Count lines and inspect duplicate forwarding or tracing fields Remove duplicates or adjust http_max_hdr narrowly
Small HTTP/1.1 request fails before routing Host header, PROXY preface and TLS termination Make the connection framing and protocol settings agree
HTTP/1.1 works but HTTP/2 fails Varnish HTTP/2 header-list diagnostics and configured limit Reduce the decoded header list or adjust the HTTP/2 limit
After a request-limit change, Varnish returns 503 with backend header errors Origin response headers and VSL FetchError/BogoHeader records Fix backend response parsing separately; do not treat it as the client-side 400

Verify the fix and guard against regression

  • Replay the original request through the public endpoint and directly against each available hop.
  • Test both HTTP/1.1 and HTTP/2 if both are enabled.
  • Include a normal request, the largest legitimate cookie set and a deliberately oversized test in a controlled environment.
  • Confirm that the request reaches the intended backend and that Nginx access/error logs and VSL no longer show the rejection markers.
  • Watch memory, workspace exhaustion, connection errors and latency after raising any limit.
  • Keep configuration changes versioned with the measured header lengths, affected virtual host, software versions and rollback procedure.

If the public status changes from 400 to 503, stop applying client-header changes. The new status indicates a different investigation: inspect backend response headers, origin syntax and Varnish fetch diagnostics.

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

Prevention checklist

  • Set a documented maximum for application cookies and expire old names during releases.
  • Normalize forwarded headers at each trusted boundary instead of allowing unbounded appends.
  • Keep health checks and synthetic monitors compliant with the protocol expected by the listener.
  • Document whether each connection uses TLS, clear-text HTTP, PROXY protocol and which version.
  • Alert on rising Varnish BogoHeader, LostHeader and 400 counts before users report failures.
  • Record Nginx and Varnish versions with every limit change because defaults and parameter names can vary by release, build and edition.

Documentation used for the limits and behaviors

The per-field Nginx rule and the four 8 KB large_client_header_buffers default are documented in the NGINX Modules Reference and core-module documentation (2025). Varnish’s missing-Host behavior, malformed-header diagnostics and client-side 400 handling are described in Varnish Software’s built-in VCL and troubleshooting documentation. The http_max_hdr, http_req_hdr_len and http_req_size defaults come from the Varnish Cache varnishd reference. Confirm the corresponding documentation for the exact versions installed in your environment before changing production limits.