tcp-over-http icon indicating copy to clipboard operation
tcp-over-http copied to clipboard

Add arbitrary headers to HTTP request

Open ShaunMaher opened this issue 1 year ago • 1 comments

Would it be possible to modify your fine application to add arbitrary HTTP request headers.

My specific use case is tunneling traffic through a web server that is presented to the world via CloudFlare. It would add a layer of security if I could as CloudFlare to require that all connections to the endpoint require a CloudFlare service token. Basically that just means that the HTTP client needs to add two additional HTTP headers to the request.

Thanks Shaun

ShaunMaher avatar May 19 '23 06:05 ShaunMaher

(i dont understand what you are trying to do)

in src/entry.rs

async fn init_http_session(target: &Url) -> Trace<Uuid> {
    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("key", "value".try_into().unwrap());
    let resp = CLIENT
        .get(join_url(target, ["open"]))
        .headers(headers)
        .header("key", "value")
        .send()
        .await
        .unwrap();
...

Hezuikn avatar May 19 '23 07:05 Hezuikn