# How to disable/not to send Last-Modified Header

**URL:** <https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001>\
**Category:** NGINX\
**Created:** [March 11, 2010, 6:09pm UTC](https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001 "2010-03-11T18:09:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tunggad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@tunggad](https://www.ruby-forum.com/u/tunggad)\
**Post date:** [March 11, 2010, 6:09pm UTC](https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001/1 "2010-03-11T18:09:10Z")

</div>

We are using NGINX to front end Jetty Server, serving static content is  
done by NGINX and we want to disable/remove the Last-Modified Header.

The Reason why we want to disable this header is to eliminate validation  
requests If-Modified-Since. The build process automatically changes the  
filename of the static artefacts every when we deploy new version, so  
these validation requests are not necessary.

Thank you for your help!

Posted at Nginx Forum:

> **[How to disable/not to send Last-Modified Header](https://forum.nginx.org/read.php?2,62782,62782#msg-62782)**
>
> We are using NGINX to front end Jetty Server, serving static content is done by NGINX and we want to disable/remove the \[b\]Last-Modified\[/b\] Header. The Reason why we want to disable this header is to eliminate validation requests...

---

<div class="post-metadata">

**Author:** ![tunggad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@tunggad](https://www.ruby-forum.com/u/tunggad)\
**Post date:** [March 11, 2010, 10:01pm UTC](https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001/2 "2010-03-11T22:01:05Z")

</div>

On Thu, Mar 11, 2010 at 12:08:43PM -0500, tunggad wrote:

> We are using NGINX to front end Jetty Server, serving static content is done by NGINX and we want to disable/remove the Last-Modified Header.
> 
> The Reason why we want to disable this header is to eliminate validation requests If-Modified-Since. The build process automatically changes the filename of the static artefacts every when we deploy new version, so these validation requests are not necessary.

Disabling If-Modified-Since validation:

```
 if_modified_since off;

```

Removing Last-Modified header:

```
 add_header Last-Modified "";

```

However, I do not see why If-Modified-Since may hinder if you generete  
unique names.

–  
Igor S.  
[http://sysoev.ru/en/](http://sysoev.ru/en/)

---

<div class="post-metadata">

**Author:** ![tunggad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@tunggad](https://www.ruby-forum.com/u/tunggad)\
**Post date:** [March 13, 2010, 10:42pm UTC](https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001/3 "2010-03-13T22:42:17Z")

</div>

Thank you Igor!

sure, with or without Last-Modified header does not matter with  
generating unique names for the static artifacts (js, css, images).  
But setting Last-Modified header results the browsers send  
if\_modified\_since to nginx to check freshness of the files, which are  
actually unnecessary, cost server processing time.

Setting Expires Header and change name of the files are enough to ensure  
that the browsers always get the fresh version at the right time. is it  
right so ?

Again, thank you igor!

Posted at Nginx Forum:

> **[Re: How to disable/not to send Last-Modified Header](https://forum.nginx.org/read.php?2,62782,63507#msg-63507)**
>
> We are using NGINX to front end Jetty Server, serving static content is done by NGINX and we want to disable/remove the \[b\]Last-Modified\[/b\] Header. The Reason why we want to disable this header is to eliminate validation requests...

---

<div class="post-metadata">

**Author:** ![tunggad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@tunggad](https://www.ruby-forum.com/u/tunggad)\
**Post date:** [January 12, 2011, 10:13pm UTC](https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001/4 "2011-01-12T22:13:23Z")

</div>

Hi,

Sorry for the bump, but this didn’t fix the issue in my case.

I have static files that never change. I want to set future expires  
header for them and to force the browser NOT to check if the cached  
version is valid with if-modified-since conditional GET.

when I remove the Last-Modified header in nginx like Igor suggested,  
Only the expires and cache-control (max-age…) get sent, but I think  
the browser doesn’t even save the resource in cache (tried with both IE8  
and FF3.6).

This is my related configuration block:

```auto
location ~* \.(js|css|png|jpg|jpeg|gif|htc)$ {
   expires max;
   add_header Cache-Control public;
}
```

Thanks!

Posted at Nginx Forum:

> **[Re: How to disable/not to send Last-Modified Header](https://forum.nginx.org/read.php?2,62782,165708#msg-165708)**
>
> We are using NGINX to front end Jetty Server, serving static content is done by NGINX and we want to disable/remove the \[b\]Last-Modified\[/b\] Header. The Reason why we want to disable this header is to eliminate validation requests...

---

<div class="post-metadata">

**Author:** ![tunggad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@tunggad](https://www.ruby-forum.com/u/tunggad)\
**Post date:** [January 15, 2011, 1:08am UTC](https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001/5 "2011-01-15T01:08:00Z")

</div>

Hi Maxim,

Thank you for your wonderful answer. Much appreciated!

Posted at Nginx Forum:

> **[Re: How to disable/not to send Last-Modified Header](https://forum.nginx.org/read.php?2,62782,166422#msg-166422)**
>
> We are using NGINX to front end Jetty Server, serving static content is done by NGINX and we want to disable/remove the \[b\]Last-Modified\[/b\] Header. The Reason why we want to disable this header is to eliminate validation requests...

---

<div class="post-metadata">

**Author:** ![tunggad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@tunggad](https://www.ruby-forum.com/u/tunggad)\
**Post date:** [January 13, 2011, 2:27pm UTC](https://www.ruby-forum.com/t/how-to-disable-not-to-send-last-modified-header/185001/6 "2011-01-13T14:27:08Z")

</div>

Hello!

On Wed, Jan 12, 2011 at 04:12:14PM -0500, bartzy wrote:

> Sorry for the bump, but this didn’t fix the issue in my case.
> 
> I have static files that never change. I want to set future expires  
> header for them and to force the browser NOT to check if the cached  
> version is valid with if-modified-since conditional GET.

Short answer: you can’t.

Long answer: browsers do whatever they want and can’t be forced to  
not check cached resource. Most of the checks may be avoided with  
“expires max;” directive, but not all.

> when I remove the Last-Modified header in nginx like Igor suggested,  
> Only the expires and cache-control (max-age…) get sent, but I think  
> the browser doesn’t even save the resource in cache (tried with both IE8  
> and FF3.6).

Igor never suggested to remove Last-Modified header, he just  
answered how to do it. It’s thread starter who thinks this will  
help.

Maxim D.
