# Proxy\_ignore\_headers Cache-Control + Set-Cookie do not work both

**URL:** <https://www.ruby-forum.com/t/proxy-ignore-headers-cache-control-set-cookie-do-not-work-both/236470>\
**Category:** NGINX\
**Created:** [September 5, 2013, 3:10pm UTC](https://www.ruby-forum.com/t/proxy-ignore-headers-cache-control-set-cookie-do-not-work-both/236470 "2013-09-05T15:10:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [September 5, 2013, 3:10pm UTC](https://www.ruby-forum.com/t/proxy-ignore-headers-cache-control-set-cookie-do-not-work-both/236470/1 "2013-09-05T15:10:04Z")

</div>

Hi,  
in a reverse-proxy setup I want to ignore “Cache-Control:” and  
“Set-Cookie:”  
for .css and some more.

Each one works perfectly.

Pages sent with a cookie are being cached:  
location ~\* .(css|ico|js) {  
proxy\_pass [http://Upstream-server](http://Upstream-server);  
proxy\_ignore\_headers Set-Cookie; }

Pages sent with a cookie are being cached (just for reference):  
location ~\* .(css|ico|js) {  
proxy\_pass [http://Upstream-server](http://Upstream-server);  
proxy\_ignore\_headers Set-Cookie Expires; }

Pages sent with a cookie are NOT being cached:  
location ~\* .(css|ico|js) {  
proxy\_pass [http://Upstream-server](http://Upstream-server);  
proxy\_ignore\_headers Set-Cookie Cache-Control; }

nginx version: nginx/1.1.19  
Ubuntu 12.04 LTS.

What am I doing wrong?

Falk

Posted at Nginx Forum:

> **[proxy\_ignore\_headers Cache-Control + Set-Cookie do not work both](https://forum.nginx.org/read.php?2,242558,242558#msg-242558)**
>
> Hi, in a reverse-proxy setup I want to ignore "Cache-Control:" and "Set-Cookie:" for .css and some more. Each one works perfectly. Pages sent with a cookie are being cached: location ~\* \\.(css|ico|js) { proxy\_pass

---

<div class="post-metadata">

**Author:** ![falk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/8c91f0/32.png) [@falk](https://www.ruby-forum.com/u/falk)\
**Post date:** [September 5, 2013, 7:33pm UTC](https://www.ruby-forum.com/t/proxy-ignore-headers-cache-control-set-cookie-do-not-work-both/236470/2 "2013-09-05T19:33:38Z")

</div>

Hello!

On Thu, Sep 05, 2013 at 09:09:06AM -0400, Falk wrote:

> nginx version: nginx/1.1.19  
> Ubuntu 12.04 LTS.
> 
> What am I doing wrong?

Ignoring the Cache-Control header likely results in no cache time  
information available. You have to set proxy\_cache\_valid then for  
a cache to work, see [Module ngx\_http\_proxy\_module](http://nginx.org/r/proxy_cache_valid).

–  
Maxim D.  
[http://nginx.org/en/donation.html](http://nginx.org/en/donation.html)
