The RPC endpoints no longer change much, but every minor release enforces that
all peers in a Cluster must run on the same version.
This was meant to allow greater flexibility when upgrading the RPC
endpoints. Now we should not be in a situation that releasing a minor cluster
version causes peers incompatibilities, even though nothing changes on the RPC
side of things.
Therefore we make 0.12 the RPC protocol version going forward and detach it
from the actual cluster version from this point.
This commit makes the proxy extract useful fixed headers (like CORS) from
the IPFS daemon API responses and then apply them to the responses
from hijacked endpoints like /add or /repo/stat.
It does this by caching a list of headers from the first IPFS API
response which has them. If we have not performed any proxied request or
managed to obtain the headers we're interested in, this will try triggering a
request to "/api/v0/version" to obtain them first.
This should fix the issues with using Cluster proxy with IPFS Companion and
Chrome.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>