-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to proxy request to another host and pass response back to original caller #1350
Comments
Ok, so it looks like this is impossible until #1065 is implemented? |
Closing as people don't really seem to answer questions here |
I'm not aware of any middleware (in Rocket terms, it would probably be either a
That shouldn't be a requirement; the main limitation of 0.4 that might apply is "one in-flight request per worker thread", but this should not be a problem for static file serving in particular.
An HTTP proxy is unfortunately less basic than it seems. The biggest issues are with headers - some of which need to be forwarded, and some of which don't - and with the forwarding of different transfer encodings of bodies. For the specific case of a static file server like
As for "a good place to start": I would start by getting something working in a route directly, and when I was comfortable with the implementation I would adapt it to either a Fairing or a custom Responder. For the case of proxying, a |
@jebrosen Hey, thanks for your detailed response, I know my question was long, so I appreciate that! That gives me more confidence in using rocket.rs moving forward, because I was afraid there wouldn't be enough community support if I get stuck, and this is my first project with Rust as well. But I actually found that you can use Thanks for all you do, rocket.rs team! |
That is probably the best solution; it's similar to my |
I definitely did too...although, the last time I used React, this was not an option....thankfully there is a really good example of an integration here: https://github.com/ghotiphud/rust-web-starter |
On a semi-related note, rocket also rejects the proxied requests, even though using them without a proxy works fine...full disclosure I just started using warp, because of this and also lack of support for |
That doesn't sound right. The first thing that comes to mind is that the request URI doesn't match. If you request
Sorry to hear that. The |
TL;DR use this if you're integrating rocket with
create-react-app
version: 0.4.5
steps taken: looked at docs, google, source code, issues, etc.
Hi, I was wondering if there was any middleware for a proxy server or what would be the best way to go about creating a proxy server so I can forward requests to my
create-react-app
server instance.If you are unfamiliar, during development, the
create-react-app
server listens on port3000
and supplies the front end for development.In the past I have used express-http-proxy for my typescript code to forward development traffic to that port.
I know what I'm asking is super basic and is probably fairly easy to create, but I guess I was wondering if there was already a prepared solution or recommended approach to save myself and possibly others some time. And if not, we could create something that benefits the community as a whole.
Is there a project in place already? What would be a good place to start? I have not seen a place to create middleware or a list of middlewares that already exist, is there one yet?
The text was updated successfully, but these errors were encountered: