-
Notifications
You must be signed in to change notification settings - Fork 3
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
Running the example gives a Content Encoding Error #18
Comments
I need to investigate further why this was okay before but isn't now (maybe some added default feature to #[get("/{url:.*}")]
async fn proxy(
path: web::Path<(String,)>,
client: web::Data<Client>,
) -> Result<HttpResponse, SendRequestError> {
let (url,) = path.into_inner();
- let url = format!("https://duckduckgo.com/{url}");
+ // duckduckgo doesn't like to be proxied anymore it looks like, showing only a blank screen
+ let url = fomrat!("https://users.rust-lang.org/{url}");
- Ok(client.get(&url).send().await?.into_http_response())
+ Ok(client.get(&url).no_decompress().send().await?.into_http_response())
// ^^^^^^^^^^^^^^^^
} I haven't yet thought about the problem of content encoding during proxying. Or more generally speaking, this crate only does half the proxying, because it ignores any request headers from the client. This might be a good opportunity to provide a second trait |
Thanks @jofas, your updated example is very useful. I understand the problem, too. Nice explanation. |
Example
main.rs
from #17:And example
Cargo.toml
adapted from #2:However, I get a Conent Encoding Error:
Is there something I'm doing wrong?
I saw @Sleepful's comment and CORS Anywhere is essentially the functionality I want to emulate, but using Actix. You could entertain the notion that my company blocked Connections so I was hoping to create a proxy to it on an existing website I have whose server is running on Actix. That might bypass the hypothetical block...
P.S., thank you for your work on this package. It looks really promising. I have also seen redirection.io's Actix Proxy, but it does a lot of magic-y things. I like that with this package I can still easily specify the route, for example. It seems to meld well with base Actix.
The text was updated successfully, but these errors were encountered: