Skip to content

Commit

Permalink
Fix CDN in flight request header name config (#435)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
NathanFlurry committed Feb 2, 2024
1 parent 1690e5e commit 6b2f439
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions svc/api/route/src/route/traefik/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ pub async fn build_cdn(ctx: &Ctx<Auth>) -> GlobalResult<traefik::TraefikConfigRe
traefik::TraefikMiddlewareHttp::InFlightReq {
// This number needs to be high to allow for parallel requests
amount: 128,
source_criterion: traefik::InFlightReqSourceCriterion::RequestHeaderName {
request_header_name: if util::env::dns_provider() == Some("cloudflare") {
source_criterion: traefik::InFlightReqSourceCriterion::RequestHeaderName(
if util::env::dns_provider() == Some("cloudflare") {
"cf-connecting-ip".to_string()
} else {
"x-forwarded-for".to_string()
},
},
),
},
);
config.http.middlewares.insert(
Expand Down
2 changes: 1 addition & 1 deletion svc/api/route/src/route/traefik/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ pub enum InFlightReqSourceCriterion {
#[serde(rename = "ipStrategy")]
IpStrategy(IpStrategy),
#[serde(rename = "requestHeaderName", rename_all = "camelCase")]
RequestHeaderName { request_header_name: String },
RequestHeaderName(String),
#[serde(rename = "requestHost", rename_all = "camelCase")]
RequestHost {},
}

0 comments on commit 6b2f439

Please sign in to comment.