Commit
+6 -1 +/-2 browse
1 | diff --git a/CHANGELOG.md b/CHANGELOG.md |
2 | index 9361a81..5c42609 100644 |
3 | --- a/CHANGELOG.md |
4 | +++ b/CHANGELOG.md |
5 | @@ -1,5 +1,9 @@ |
6 | # Changelog |
7 | |
8 | + ## WIP: v0.3.5 |
9 | + |
10 | + - Support X-Forwarded-Host headers to work better with load balancers. #31 |
11 | + |
12 | ## v0.3.4 |
13 | |
14 | - Fixed the S3 backend: 1c0d6c7e2638963e6755669c6013daae2fe47ee7 |
15 | diff --git a/src/hyperext.rs b/src/hyperext.rs |
16 | index 529998d..aec12b4 100644 |
17 | --- a/src/hyperext.rs |
18 | +++ b/src/hyperext.rs |
19 | @@ -55,7 +55,8 @@ impl<B> RequestExt for Request<B> { |
20 | |
21 | fn authority(&self) -> Option<Authority> { |
22 | self.headers() |
23 | - .get(":authority") |
24 | + .get("X-Forwarded-Host") |
25 | + .or_else(|| self.headers().get(":authority")) |
26 | .or_else(|| self.headers().get("Host")) |
27 | .and_then(|authority| { |
28 | Authority::try_from(authority.as_bytes()).ok() |