# Priority of cache-control, expires, x-accel-expires

**URL:** <https://www.ruby-forum.com/t/priority-of-cache-control-expires-x-accel-expires/214490>\
**Category:** NGINX\
**Created:** [December 3, 2011, 1:06am UTC](https://www.ruby-forum.com/t/priority-of-cache-control-expires-x-accel-expires/214490 "2011-12-03T01:06:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [December 3, 2011, 1:06am UTC](https://www.ruby-forum.com/t/priority-of-cache-control-expires-x-accel-expires/214490/1 "2011-12-03T01:06:26Z")

</div>

How does nginx caching handle multiple cache control headers sent from a  
backend?

I had a situation where I was sending both expires and cache-control and  
it seemed that the order in which they were sent controlled. I solved  
that problem by ignoring the expires header.

I thought I recalled that x-accel-expires would override any other  
headers regardless of order, but that doesn’t seem to be the case.

Is there a priority, or does order control?

Posted at Nginx Forum:

> **[Priority of cache-control, expires, x-accel-expires](https://forum.nginx.org/read.php?2,219520,219520#msg-219520)**
>
> How does nginx caching handle multiple cache control headers sent from a backend? I had a situation where I was sending both expires and cache-control and it seemed that the order in which they were sent controlled. I solved that problem by ignoring...

---

<div class="post-metadata">

**Author:** ![brianmercer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/839c29/32.png) [@brianmercer](https://www.ruby-forum.com/u/brianmercer)\
**Post date:** [December 5, 2011, 10:30am UTC](https://www.ruby-forum.com/t/priority-of-cache-control-expires-x-accel-expires/214490/2 "2011-12-05T10:30:32Z")

</div>

Hello!

On Fri, Dec 02, 2011 at 07:05:42PM -0500, brianmercer wrote:

> How does nginx caching handle multiple cache control headers sent from a  
> backend?
> 
> I had a situation where I was sending both expires and cache-control and  
> it seemed that the order in which they were sent controlled. I solved  
> that problem by ignoring the expires header.

First of the Expires and/or Cache-Control is used.

> I thought I recalled that x-accel-expires would override any other  
> headers regardless of order, but that doesn’t seem to be the case.

X-Accel-Expires will override both Expires and Cache-Control,  
regardless of the order.

Maxim D.
