# If-Modified-Since

**URL:** <https://www.ruby-forum.com/t/if-modified-since/219753>\
**Category:** NGINX\
**Created:** [May 15, 2012, 11:29am UTC](https://www.ruby-forum.com/t/if-modified-since/219753 "2012-05-15T11:29:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 15, 2012, 11:29am UTC](https://www.ruby-forum.com/t/if-modified-since/219753/1 "2012-05-15T11:29:54Z")

</div>

Hi,

I’m obviously losing it somehow. What am I missing here, it must be  
something obvious that is going to make me look stupid, but I still  
don’t see it. I just can’t get If-Modified-Since to work?

Linux poc 3.3.4-2-ARCH #1 SMP PREEMPT Wed May 2 18:28:42 CEST 2012  
x86\_64 Intel® Xeon® CPU E5540 @ 2.53GHz GenuineIntel GNU/Linux

Default configure/make/nginx.conf etc directly from the 1.2.0 dist.

I send an IMS header, later than the last-modified, and still get a 200?

x@poc\> touch a  
x@poc\> curl -za -v localhost/index.html

- About to connect() to localhost port 80 (#0)
- Trying 127.0.0.1…
- connected
- Connected to localhost (127.0.0.1) port 80 (#0)

> GET /index.html HTTP/1.1  
> User-Agent: curl/7.25.0 (x86\_64-unknown-linux-gnu) libcurl/7.25.0 OpenSSL/1.0.1b  
> zlib/1.2.7 libssh2/1.4.0  
> Host: localhost  
> Accept: _/_  
> If-Modified-Since: Tue, 15 May 2012 11:18:36 GMT

\< HTTP/1.1 200 OK  
\< Server: nginx/1.2.0  
\< Date: Tue, 15 May 2012 11:18:40 GMT  
\< Content-Type: text/html  
\< Content-Length: 151  
\< Last-Modified: Tue, 15 May 2012 11:17:22 GMT  
\< Connection: keep-alive  
\< Accept-Ranges: bytes  
[…]

Same request against Apache

x@poc\> touch a  
x@poc\> curl -za -v localhost/index.html

- About to connect() to localhost port 80 (#0)
- Trying 127.0.0.1…
- connected
- Connected to localhost (127.0.0.1) port 80 (#0)

> GET /index.html HTTP/1.1  
> User-Agent: curl/7.25.0 (x86\_64-unknown-linux-gnu) libcurl/7.25.0 OpenSSL/1.0.1b  
> zlib/1.2.7 libssh2/1.4.0  
> Host: localhost  
> Accept: _/_  
> If-Modified-Since: Tue, 15 May 2012 11:25:13 GMT

\< HTTP/1.1 304 Not Modified  
\< Date: Tue, 15 May 2012 11:25:14 GMT  
\< Server: Apache/2.2.22 (Unix) mod\_ssl/2.2.22 OpenSSL/1.0.1b DAV/2  
\< ETag: “89985-5-4c011747da2b3”

Kind regards,  
Fredrik

---

<div class="post-metadata">

**Author:** ![Fredrik\_Widlund](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/278dde/32.png) [@Fredrik\_Widlund](https://www.ruby-forum.com/u/Fredrik_Widlund)\
**Post date:** [May 15, 2012, 12:37pm UTC](https://www.ruby-forum.com/t/if-modified-since/219753/2 "2012-05-15T12:37:00Z")

</div>

On Tuesday 15 May 2012 13:29:00 Fredrik Widlund wrote:

> > User-Agent: curl/7.25.0 (x86\_64-unknown-linux-gnu) libcurl/7.25.0  
> > \< Connection: keep-alive  
> > \< Accept-Ranges: bytes  
> > […]  
> > […]

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#if_modified_since)**
>
> This directive appeared in version 1.11.8.

default: if\_modified\_since exact;  
And here is explained why: [#93 (If-Modified-Since rfc compliance) – nginx](http://trac.nginx.org/nginx/ticket/93)

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![Fredrik\_Widlund](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/278dde/32.png) [@Fredrik\_Widlund](https://www.ruby-forum.com/u/Fredrik_Widlund)\
**Post date:** [May 15, 2012, 12:53pm UTC](https://www.ruby-forum.com/t/if-modified-since/219753/3 "2012-05-15T12:53:46Z")

</div>

Is this compliant by default? RFC 2616 says the server shouldn’t return  
200 if the variant is unmodified since IMS?

Anyway, as long as it is configurable. Thanks!

Kind regards,  
Fredrik

---

<div class="post-metadata">

**Author:** ![Fredrik\_Widlund](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/278dde/32.png) [@Fredrik\_Widlund](https://www.ruby-forum.com/u/Fredrik_Widlund)\
**Post date:** [May 15, 2012, 4:07pm UTC](https://www.ruby-forum.com/t/if-modified-since/219753/4 "2012-05-15T16:07:50Z")

</div>

On Tuesday 15 May 2012 14:52:50 Fredrik Widlund wrote:

> Is this compliant by default? RFC 2616 says the server shouldn’t return 200  
> if the variant is unmodified since IMS?

It’s conditionally complaint, please, look at the explanation by Maxim  
Dounin:

> **[comment:3 by Maxim Dounin, 15 years ago - #93 (If-Modified-Since rfc...](https://trac.nginx.org/nginx/ticket/93#comment:3)**
>
> Yes, we are using Last-Modified much like ETag. Obvious advantage of Last-Modified over ETag is that Last-Modified is the only one present in HTTP/1.0 (and hence must be supported anyway). Please also see the following note from ​RFC 2616:

And it’s chosen as the default because it’s more reliable and safe.

wbr, Valentin V. Bartenev
