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?

@xiaoliang-wang
Copy link

I'm very interested in this function. Could you provide some examples to help me understand how to use it better?

Copy link

@daviscloudflare daviscloudflare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@drcaramelsyrup drcaramelsyrup added the Accepted This change is accepted by us and merged to our internal repo label Dec 24, 2025
@ma-ts
Copy link
Author

ma-ts commented Dec 24, 2025

@drcaramelsyrup / @daviscloudflare: thanks both for assigning and reviewing! What is required to get this merged?

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

Labels

Accepted This change is accepted by us and merged to our internal repo enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants