I want to use the "Cache Purge" module to generate "internal" requests to purge or expire individual items in the proxy cache from within our Lua request handler. This module appears to work by using a made-up HTTP method (PURGE) in a request that targets the intended item.
I'd like to use ngx.location.capture to generate the PURGE requests but it doesn't look like that's possible because as far as I can tell only the predefined "real" HTTP methods (GET, POST, etc.) can be specified in calls to ngx.location.capture or ngx.location.capture_multi.
I might be able to finesse it by using DELETE instead of PURGE, but strictly speaking DELETE means something completely different in REST/HTTP terms, and in theory DELETE could be used to target and remove the original item rather than the cached copy, and even though that isn't currently permitted in this context I'd prefer not to preclude it.
Is there any way to achieve this apart from issuing additional "real" HTTP requests from within out handler, perhaps using the lua-resty-http-simple module to which Brian referred in another post? (Assuming that it's possible even there to use a made-up request method.)