Skip to content

Conversation

@ma-ts
Copy link

@ma-ts ma-ts commented Dec 1, 2025

I am currently working on a use-case to use Pingora to provide both TLS passthrough and as a HTTP proxy / load balancer. For this, what I need to do is accept a TLS session, do an SNI peek, and then make the decision of whether or not I want to provide it to the HTTP proxy, or just do a direct passthrough, something like this:

use pingora_proxy::http_proxy;
use pingora_core::apps::HttpServerApp;
use std::sync::Arc;

let proxy = Arc::new(http_proxy(&server_conf, my_proxy_app));
loop {
    let (stream, addr) = listener.accept().await?;
    
    // check SNI host, make decision
    
    if should_terminate_tls {
        let tls_stream = my_acceptor.accept(stream).await?;
        let session = HttpSession::new_http1(Box::new(tls_stream));
        proxy.process_new_http(session, &shutdown).await;
    }
}

However, currently HttpSession is not public, which makes this very difficult for this use-case. Would it be possible to open this up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants