mirror of
https://github.com/actix/examples
synced 2024-11-23 22:41:07 +01:00
Do not decompress proxied responses (#151)
If you decompress a proxied response that was encoded, the `content-encoding` header will be passed through but a plaintext body will be returned.
This commit is contained in:
parent
b0d3c652b2
commit
58675a683b
@ -15,7 +15,7 @@ fn forward(
|
||||
new_url.set_path(req.uri().path());
|
||||
new_url.set_query(req.uri().query());
|
||||
|
||||
let forwarded_req = client.request_from(new_url.as_str(), req.head());
|
||||
let forwarded_req = client.request_from(new_url.as_str(), req.head()).no_decompress();
|
||||
let forwarded_req = if let Some(addr) = req.head().peer_addr {
|
||||
forwarded_req.header("x-forwarded-for", format!("{}", addr.ip()))
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user