initial support forwarded header

This commit is contained in:
Jun Kurihara 2025-07-04 17:10:24 +09:00
commit a73321cb27
No known key found for this signature in database
GPG key ID: B184DE07B34AA676
4 changed files with 142 additions and 6 deletions

View file

@ -87,7 +87,7 @@ where
remove_connection_header(headers);
// delete hop headers including header.connection
remove_hop_header(headers);
// X-Forwarded-For
// X-Forwarded-For (and Forwarded if exists)
add_forwarding_header(headers, client_addr, listen_addr, tls_enabled, &original_uri)?;
// Add te: trailer if te_trailer
@ -126,7 +126,7 @@ where
// apply upstream-specific headers given in upstream_option
let headers = req.headers_mut();
// apply upstream options to header
// apply upstream options to header, after X-Forwarded-For is added
apply_upstream_options_to_header(headers, &upstream_chosen.uri, upstream_candidates)?;
// update uri in request