subrequest in memory for non-upstream requests
dermiste at kilob.yt
Wed Dec 25 12:14:57 UTC 2013
After some trial and errors I have a working prototype of arbitrary
external http subrequests, i.e. I can fetch an external resource from a
URL provided at request-time. Basically I spawn an in-memory subrequest
and call ngx_http_upstream_init right after.
subrequest_in_memory only works when there is an upstream. So, if the
resource to be fetched is on the same server, I have 2 options:
1) establish an upstream connection to myself or
2) use an http output filter to catch the subrequest's response body.
To give more context: These requests are used to fetch public key
informations to authenticate http clients, so the contents will not
change often, and it will have a high temporal locality. So basically we
fetch the content the first time, and then we use the content in cache.
Also, the odds that a key is on a foreign server far outranks the odds
that the needed key is on the local server.
What is the best option here ? 1), which is simple and has a low
footprint, but will occasionally use an unnecessary loopback connection;
or 2), which introduce no loopback connections but uses an extra http
output filter to intercept the outbound bytes?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
More information about the nginx-devel