3

How can I configure nginx to pass a PURGE request from localhost to the Varnish backend?

Currently, the script causes this line to appear in the nginx logs:

127.0.0.1 - - [23/Apr/2012:20:12:31 -0500] "PURGE /blog HTTP/1.1" 405 173 "-" "-"

Is there any way to rewrite this purge request to the Varnish backend (127.0.0.1:8080)?

1 Answer 1

3

Something like this could work:

error_page 418 = @purgepass;

location / {
    if ($request_method = PURGE ) {
        return 418;
    }
}

location @purgepass {
    proxy_pass http://localhost:8080;
}

Not tested, but in theory it should work.

Based on http://blog.rogeriopvl.com/archives/nginx-and-the-http-options-method/

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .