Forum: NGINX proxy_cache seems not working with X-Accel-Redirect

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2974d09ac2541e892966b762aad84943?d=identicon&s=25 gray (Guest)
on 2013-08-09 12:21
(Received via mailing list)
My config

location ~ /cached/ {
        proxy_pass  http://apache;
        proxy_cache cache;
        proxy_cache_valid 2h;
        proxy_cache_key "$host|$request_uri";

}

location /htdocs_internal/ {
            internal;

            alias $htdocs_path;
}

Requests with header in reply X-Accel-Redirect not cached, every time
request is sent to apache. When i add these directives
proxy_pass_header X-Accel-Redirect;
proxy_ignore_headers X-Accel-Redirect;
cache works fine (but is useless :) ), so it isn't problem with "no
cache"
headers from apache.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,241734,241734#msg-241734
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-08-17 04:33
(Received via mailing list)
Hello!

On Fri, Aug 09, 2013 at 06:20:21AM -0400, gray wrote:

> location /htdocs_internal/ {
> headers from apache.
Yes, proxy_cache can't cache responses with X-Accel-Redirect.

As a workaround, you may use an additional proxy layer with
proxy_cache and proxy_ignore_headers X-Accel-Redirect +
proxy_pass_headers X-Accel-Redirect.

--
Maxim Dounin
http://nginx.org/en/donation.html
This topic is locked and can not be replied to.