cloudflare / cloudflare/pingora
Unclear how to get request host
- Dominant language
- Rust
- Stars
- 27.4k
- Forks
- 1.7k
- Avg merge
- 6h 22m
- Merged PRs (30d)
- 3
Description
## What is the problem your feature solves, or the need it fulfills?
This is code I have
```
async fn upstream_peer(
&self,
session: &mut Session,
_ctx: &mut Self::CTX,
) -> pingora::Result> {
let Some(host) = session.req_header().uri.host() else {
return Err(pingora::Error::new_str("host unset"));
};
```
it reports host unset. Which is probably expected. But then how do I get host? I guess
```
session.req_header().headers.get("host")
```
or
```
session.req_header().headers.get(":authority")
```
or both?
## Describe the solution you'd like
Add a function like
```
RequestHeader::host(&self) -> &str
```
## Describe alternatives you've considered
Continue reading sources.
## Additional context
0.5.0
Contributor guide
Assessment
This issue has not been assessed yet.