proxy_cache seems not working with X-Accel-Redirect

Maxim Dounin mdounin at mdounin.ru
Wed Jan 11 14:33:32 UTC 2017


Hello!

On Wed, Jan 11, 2017 at 07:39:32AM -0500, bdesemb wrote:

> Hi Maxim,
> 
> Can you post an example please? I don't understand how to do that.

Try something like this:

    server {
        server 8080;

        location / {
            # no caching configured, only proxying to an intermediate 
            # caching layer; X-Accel-Redirect is processed here

            proxy_pass http://127.0.0.1:8081;
        }
    }

    server {
        server 8081;

	location / {
	    # here caching happens; to cache X-Accel-Redirect 
	    # responses, the header is ignored

            proxy_pass http://real-upstream-server;
            proxy_cache foo;
            proxy_ignore_headers X-Accel-Redirect;
        }
    }

-- 
Maxim Dounin
http://nginx.org/


More information about the nginx mailing list