1
0
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:
Julian Tescher 2019-06-28 01:52:12 -07:00 committed by Nikolay Kim
parent b0d3c652b2
commit 58675a683b

View File

@ -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 {