0

We are using Nginx as a reverse proxy and everything seems to work fine.We have caching enabled and this was working fine from Nov 15 to Nov 30. The proxied server returns a request which has expires header set to expire after 5 mins. However this stopped working on Dec 1. And the culprit seems to be the date format. With a simple test case we were able to figure out that :

 new org.mockserver.model.Header("Expires", "Tue, 04 Dec 2018 16:23:31 GMT")

Works fine. However this fails:

 new org.mockserver.model.Header("Expires", "Tue, 4 Dec 2018 16:23:31 GMT")

The following are my proxy settings:

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=nginx_cache:10m max_size=10g use_temp_path=off;

proxy_cache nginx_cache;
proxy_cache_methods GET;
proxy_ignore_headers Set-Cookie;

Is it a problem with my configuration or is it a issue with Nginx ? This was issue we tried in bot Nginx version 1.3.7 and 1.3.10

EDITED These headers were sent from a thirdparty API. However they seem to be also sending other headers (example form test case):

        new org.mockserver.model.Header("Date", "Tue, 04 Dec 2018 16:13:45 GMT"),
        new org.mockserver.model.Header("Expires", "Tue, 6 Dec 2018 16:23:31 GMT"),
        new org.mockserver.model.Header("Cache-Control", "max-age=586, must-revalidate")

and as per this link, the cache-control should have had precedence : what’s the difference between Expires and Cache-Control headers?

But nginx somehow seems to fail on the expires header.

Abi
  • 1
  • 1
  • That second date string is invalid - how is it generated? – Richard Smith Dec 04 '18 at 17:34
  • @RichardSmith : In our test case we were using, java.time.format.DateTimeFormatter.RFC_1123_DATE_TIME. However this was the format that was returned by the third-party API which we are calling – Abi Dec 05 '18 at 09:16
  • Added some more info in the description, about other headers. – Abi Dec 05 '18 at 09:32
  • From your edit, the `Date` header looks valid and the `Expires` header looks invalid. The date format for the `Expires` header is defined in RFC7234 §5.2 which references RFC7231 §7.1.1.1 - and an invalid date is likely to be ignored by compliment servers and browsers. – Richard Smith Dec 05 '18 at 09:47

0 Answers0