-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Transparent HTTP proxy over p2p streams #5341
Comments
The endpoint would probably be In that path:
We could (possibly later) allow the client to specify multiaddrs for the target peer in HTTP headers. @ianopolous when we discussed this, we talked about using a multiaddr instead of just a peer ID in the URL. Unfortunately, it turns out that that would introduce an ambiguity. For example, in Additionally, putting a full multiaddr in the GET path doesn't allow specifying more than one multiaddr. To be explicit, when the IPFS node receives a request of the form:
The IPFS node would:
|
I like this approach, but I would like to have a way of listening for connections, so we'd probably want a prefix for what action we want to do:
I'll try hack something together next week. (If you want to do http requests over libp2p now, you should be able to with #4929) |
@magik6k @ianopolous has actually volunteered to do this and it should be a good self-contained feature. The current plan is to use a normal p2p listener on the server. The issue @ianopolous is having with #4929 is that it requires opening a new port per peer. With this version, we can listen on the same port as the API server. We could even make it a part of the read-only API and expose it on the gateway. This would allow users to host static websites and then have their static websites make simple AJAX requests to services behind libp2p endpoints. We can even make this entirely client-side in the JS gateway using the service worker. The downside to this is that allowing semi-persistent connections on the public gateway may not be the best idea from a performance standpoint (for us). |
If not me then another Peergossian (@cboddy or @kevodwyer) will have a crack at this soon. |
Implemented by #5526 |
After talking in depth with @Stebalien about what I was hoping for from #5256 we concluded that my idea is orthogonal to what @haadcode is requesting, hence this issue.
The idea is a transparent http proxy in the http api which pipes http requests over a p2p stream to another node.
E.g. the http api would include a new endpoint like
/api/v0/http_proxy/$name/$multiaddr/$http_path
$multiaddr would be something like /ipfs/$nodeid
The $http path is the path that is sent to the target server
@Stebalien could you explain the use of $name?
The cool thing about this is it would give ANY existing web app (including dynamic stuff like talking to a database etc.) a way to move their hosting from dns location based addressing to ipfs based trivially and everything would just work. (They would still run their back end as is but with an ipfs node proxying the http connections)
We would like to use this in @Peergos to allows us to tunnel writes (et al) to particular storage servers.
Note that this automatically includes websockets.
The text was updated successfully, but these errors were encountered: