# Does nginx ignore/discard headers that have no value i.e empty value?

**URL:** <https://community.nginx.org/t/does-nginx-ignore-discard-headers-that-have-no-value-i-e-empty-value/9150>\
**Category:** NGINX\
**Tags:** reverse-proxy\
**Created:** [March 18, 2026, 4:29am UTC](https://community.nginx.org/t/does-nginx-ignore-discard-headers-that-have-no-value-i-e-empty-value/9150 "2026-03-18T04:29:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnj0496](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dnj0496](https://community.nginx.org/u/dnj0496)\
**Post date:** [March 18, 2026, 4:29am UTC](https://community.nginx.org/t/does-nginx-ignore-discard-headers-that-have-no-value-i-e-empty-value/9150/1 "2026-03-18T04:29:11Z")

</div>

_Please use this template for troubleshooting questions._

**My issue: Request headers with empty values are ignore**

**How I encountered the problem: In my module, I am reading the headers. When iterating over headers\_in list, I don’t find header with empty values.**

**Solutions I’ve tried: I’ve printed all headers received in the request. I am reading the request in post\_read phase.**

**Version of NGINX or NGINX adjacent software (e.g. NGINX Gateway Fabric): 1.28.0**

**Deployment environment: docker container.**

**Minimal NGINX config to reproduce your issue (preferably running on [https://tech-playground.com/playgrounds/nginx](https://tech-playground.com/playgrounds/nginx) for ease of debugging, and if not as a code block):** _(Tip → Run `nginx -T` to print your entire NGINX config to your terminal.)_

**NGINX access/error log:** _(Tip → You can usually find the logs in the `/var/log/nginx` directory.)_

---

<div class="post-metadata">

**Author:** ![liam](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/liam/32/99_2.png) [@liam](https://community.nginx.org/u/liam)\
**Post date:** [March 19, 2026, 9:12am UTC](https://community.nginx.org/t/does-nginx-ignore-discard-headers-that-have-no-value-i-e-empty-value/9150/2 "2026-03-19T09:12:11Z")

</div>

AFAIK, nginx discards empty request headers as they are technically invalid.  
FWIW, you will see the same behavior when iterating over headers with njs

> **[headers - Reference](https://nginx.org/en/docs/njs/reference.html#request_headers)**

Similarly, curl will not send empty request headers.

> **[5.5. Field Values - RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html#name-field-values)**
>
> HTTP field values consist of a sequence of characters in a format defined by the field's grammar. Each field's grammar is usually defined using ABNF (\[RFC5234\]).¶ | 
>        
> The Hypertext Transfer Protocol (HTTP) is a stateless application-level
> ...

---

<div class="post-metadata">

**Author:** ![dnj0496](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dnj0496](https://community.nginx.org/u/dnj0496)\
**Post date:** [March 19, 2026, 4:25pm UTC](https://community.nginx.org/t/does-nginx-ignore-discard-headers-that-have-no-value-i-e-empty-value/9150/3 "2026-03-19T16:25:35Z")

</div>

Thanks for responding @liam. Yeah, nginx does seem to discard the headers towards the proxy. However, I was interested in reading the headers from the request (headers\_in) in my module which should have been available. Turn out, they are available. It was my test that was wrong. I was using curl to send my request which was silently dropping it. As a result, I thought nginx wasn’t reading empty headers. That’s not the case. It is reading the empty headers properly.

---

<div class="post-metadata">

**Author:** ![system](https://drob5swvtjqxg.cloudfront.net/user_avatar/community.nginx.org/system/32/19_2.png) [@system](https://community.nginx.org/u/system)\
**Post date:** [April 14, 2026, 3:07pm UTC](https://community.nginx.org/t/does-nginx-ignore-discard-headers-that-have-no-value-i-e-empty-value/9150/4 "2026-04-14T15:07:36Z")

</div>

Closed on April 14, 2026, 3:07pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
