<div dir="ltr"><div>I understand your argument when nginx is normally used as a frontend server and "generation of the message" happens in nginx, but in this case, the <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header">document</a> is about the nginx proxy module where nginx proxies the "message" originated from upstream. <br></div><div>When nginx is used as a reverse proxy, I think nginx proxy module should NOT remove the "Date" header from origin by default. Other reverse proxies/caches, like Varnish, are doing the same: <a href="http://ronwilliams.io/blog/post/rfc7231-compliant-http-date-headers">http://ronwilliams.io/blog/post/rfc7231-compliant-http-date-headers</a></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 23, 2019 at 2:55 AM Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello!<br>
<br>
On Wed, May 22, 2019 at 10:30:57AM -0700, Frank Liu wrote:<br>
<br>
> Is there a reason why by default nginx doesn't pass the "Date" header from<br>
> upstream?<br>
> <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header" rel="noreferrer" target="_blank">http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header</a><br>
> <br>
> <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="noreferrer" target="_blank">https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a> seems to indicate<br>
> Date header shouldn't be altered:<br>
> <br>
> The HTTP-date sent in a Date header SHOULD NOT represent a date and time<br>
> subsequent to the generation of the message. It SHOULD represent the best<br>
> available approximation of the date and time of message generation, unless<br>
> the implementation has no means of generating a reasonably accurate date<br>
> and time. In theory, the date ought to represent the moment just before the<br>
> entity is generated. In practice, the date can be generated at any time<br>
> during the message origination without affecting its semantic value.<br>
> <br>
> If nginx, as a proxy, changes the Date header, it may mess up the caching<br>
> model of HTTP in some pretty subtle ways in the downstream.<br>
<br>
And not changing the Date will mess pretty badly with various <br>
things as introduced in nginx, such as by the "expires" <br>
directive (not to mention SSI, as well as returning various <br>
responses from cache).<br>
<br>
Since nginx is primarily developed as a frontend server, it is <br>
generally considered to be an origin server in terms of RFC 2616. <br>
Accordingly, "generation of the message" in the quote above <br>
happens in nginx, and it uses the current date by default.<br>
<br>
If you want to preserve Date as returned by the upstream server, <br>
you can use the proxy_pass_header directive to do so.<br>
<br>
-- <br>
Maxim Dounin<br>
<a href="http://mdounin.ru/" rel="noreferrer" target="_blank">http://mdounin.ru/</a><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div>