# Nginx Cache not working with wget or curl

**URL:** <https://www.ruby-forum.com/t/nginx-cache-not-working-with-wget-or-curl/204549>\
**Category:** NGINX\
**Created:** [March 15, 2011, 12:20pm UTC](https://www.ruby-forum.com/t/nginx-cache-not-working-with-wget-or-curl/204549 "2011-03-15T12:20:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [March 15, 2011, 12:20pm UTC](https://www.ruby-forum.com/t/nginx-cache-not-working-with-wget-or-curl/204549/1 "2011-03-15T12:20:17Z")

</div>

Hello,

I set up Ninx as a cache proxy for our webservers.

Everything is working fine when using a standard web browser (Firefox,  
IE, Chrome), pages are correctly cached according to the rules I have  
defined.

However, I noticed that non standard tools to retrieve web pages (wget,  
curl and some monitoring tools) are not caching pages and are always  
getting content from the backend. In the log file, I have  
upstream\_cache\_status with MISS (however, if I first call my page with  
Firefox, wget or curl are displaying the cached page).

I thought first it was due to the fact that the monitoring tool and wget  
are using HTTP/1.0 but curl is using HTTP/1.1 and the result is the  
same.

Is there a special parameters to allow such tools to cache pages ?

Thank you for your help,

Fred

Posted at Nginx Forum:

> **[Nginx Cache not working with wget or curl](https://forum.nginx.org/read.php?2,183034,183034#msg-183034)**
>
> Hello, I set up Ninx as a cache proxy for our webservers. Everything is working fine when using a standard web browser (Firefox, IE, Chrome), pages are correctly cached according to the rules I have defined. However, I noticed that non standard tools...

---

<div class="post-metadata">

**Author:** ![Fred91](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b3f665/32.png) [@Fred91](https://www.ruby-forum.com/u/Fred91)\
**Post date:** [March 15, 2011, 1:55pm UTC](https://www.ruby-forum.com/t/nginx-cache-not-working-with-wget-or-curl/204549/2 "2011-03-15T13:55:04Z")

</div>

I found how to solve this problem : a cookie was set by the loadbalancer  
of our backends.  
I added Set-cookie to proxy\_ignore\_headers.

What I don’t understand, however is why it’s working with standard web  
browsers.

Fred

Posted at Nginx Forum:

> **[Re: Nginx Cache not working with wget or curl](https://forum.nginx.org/read.php?2,183034,183053#msg-183053)**
>
> Hello, I set up Ninx as a cache proxy for our webservers. Everything is working fine when using a standard web browser (Firefox, IE, Chrome), pages are correctly cached according to the rules I have defined. However, I noticed that non standard tools...

---

<div class="post-metadata">

**Author:** ![Fred91](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b3f665/32.png) [@Fred91](https://www.ruby-forum.com/u/Fred91)\
**Post date:** [March 15, 2011, 2:14pm UTC](https://www.ruby-forum.com/t/nginx-cache-not-working-with-wget-or-curl/204549/3 "2011-03-15T14:14:34Z")

</div>

Hello!

On Tue, Mar 15, 2011 at 08:52:59AM -0400, Fred91 wrote:

> I found how to solve this problem : a cookie was set by the loadbalancer of our  
> backends.  
> I added Set-cookie to proxy\_ignore\_headers.
> 
> What I don’t understand, however is why it’s working with standard web browsers.

Most likely standard browsers sent previously set cookie and  
your backends doesn’t try to set new one.

Maxim D.
