Skip to content
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

add proxy-server example #354

Open
blittable opened this issue Dec 29, 2019 · 3 comments
Open

add proxy-server example #354

blittable opened this issue Dec 29, 2019 · 3 comments
Labels

Comments

@blittable
Copy link
Contributor

@blittable blittable commented Dec 29, 2019

Our use-case is ci/cd deployment with a non-privileged on ubuntu where the lower port ranges are restricted and can be handled with a proxy server. There may be others.

I've peeked at the hyper example: https://github.com/hyperium/hyper/blob/master/examples/http_proxy.rs and would be happy to contribute with some suggestions/guidance.

Related issue: #230

@seanmonstar
Copy link
Owner

@seanmonstar seanmonstar commented Jan 3, 2020

A naive proxy example could be a good idea! Though, there isn't currently a way to get the on_upgrade in warp to allow for tunneling.

@seanmonstar seanmonstar added the easy label Jan 3, 2020
@cheako
Copy link

@cheako cheako commented Jan 11, 2020

Looking at this it looks like this is about a Request/Response combination that results in a usable Socket afterwards? I must say the documentation isn't exactly verbose.

I'm looking to do Cut-through switching. That is I want to validate and alter Request Headers and then hand off the Body to another HTTPD without storing the body(could be several GB of file upload). I likewise want to do the same with the Response, for file downloads.

The whole story. I recently wanted to share a saved game file but I was unable to locate a file sharing service that I was happy with. I've obtained a VPS from Google, but it has limited storage. I plan to use FreeNet as my file storage backend. What I'm looking to do is pass through filtered access to an instance of FreeNet.

Can Warp do anything like this?

Edit: Similar to #175

@drakedevel
Copy link

@drakedevel drakedevel commented Mar 12, 2020

The code for warp::filters::ws could in principle be adapted into a HTTP CONNECT proxy (like the linked hyper example), but it relies on the body filter (which is private) to get access to the underlying hyper structs. So I think implementing that example in warp is actually impossible right now without changes to the library.

@seanmonstar warp seems to be careful about keeping the raw Body hidden, so I assume you want to keep it that way (so exposing the body filter wouldn't be an option). What would you think about an upgrade filter that exposes a hyper::upgrade::Upgraded? The ws filter should be able to reuse it, and the downcast function on that can get you all the way back to a raw tokio TcpStream for @cheako 's use-case (as well as my own).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.