Skip to content

Conversation

@cachpachios
Copy link

@cachpachios cachpachios commented Jan 3, 2026

Tiny fix to resolve #783

We expose a new_mtls method for creating a HttpProxy with a client_cert_key to enable mTLS peers.

AFAIK there is currently no other way to set or modify the client_cert_key field. So that small change enables to actually use mTLS HttpPeers, even if the foundations (with the field) been there for a while...

This works well for my own usecase!

Let me know if anyone prefers another approach, i.e a public setter instead of constructor. Or just a different name.
Also, looking at some previous commits it doesnt feel like this sort of changes requires tests to be written. But let me know if thats a wrong assumption.

For anyone looking to use mTLS with a self signed server certificate will you need to modify the PeerOptions too.
Here is an example from my own project:

let mut peer = Box::new(HttpPeer::new_mtls(
    target.address.to_string(),
    target.sni.clone(),
    target.client_cert.clone(),
));
let peer_options = peer.get_mut_peer_options().unwrap();
peer_options.ca = Some(target.ca.clone());

Exposes a new_mtls method for creating a HttpProxy with a client_cert_key to enable mtls peers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to set client_cert_key for mTLS for HttpPeer

1 participant