Proxy a POST request with proof generation
curl --request POST \
--url http://localhost:8080/proxy \
--header 'Content-Type: application/json' \
--header 'T-PROXY-URL: <t-proxy-url>' \
--header 'T-REQUEST-ID: <t-request-id>' \
--data '
{
"title": "usher",
"body": "labs",
"userId": 10
}
'import requests
url = "http://localhost:8080/proxy"
payload = {
"title": "usher",
"body": "labs",
"userId": 10
}
headers = {
"T-PROXY-URL": "<t-proxy-url>",
"T-REQUEST-ID": "<t-request-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'T-PROXY-URL': '<t-proxy-url>',
'T-REQUEST-ID': '<t-request-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({title: 'usher', body: JSON.stringify('labs'), userId: 10})
};
fetch('http://localhost:8080/proxy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/proxy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'usher',
'body' => 'labs',
'userId' => 10
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"T-PROXY-URL: <t-proxy-url>",
"T-REQUEST-ID: <t-request-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/proxy"
payload := strings.NewReader("{\n \"title\": \"usher\",\n \"body\": \"labs\",\n \"userId\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("T-PROXY-URL", "<t-proxy-url>")
req.Header.Add("T-REQUEST-ID", "<t-request-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/proxy")
.header("T-PROXY-URL", "<t-proxy-url>")
.header("T-REQUEST-ID", "<t-request-id>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"usher\",\n \"body\": \"labs\",\n \"userId\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/proxy")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["T-PROXY-URL"] = '<t-proxy-url>'
request["T-REQUEST-ID"] = '<t-request-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"usher\",\n \"body\": \"labs\",\n \"userId\": 10\n}"
response = http.request(request)
puts response.read_body{}Endpoints
Proxy
Forwards any HTTP request to a target URL and generates TLS proofs
POST
/
proxy
Proxy a POST request with proof generation
curl --request POST \
--url http://localhost:8080/proxy \
--header 'Content-Type: application/json' \
--header 'T-PROXY-URL: <t-proxy-url>' \
--header 'T-REQUEST-ID: <t-request-id>' \
--data '
{
"title": "usher",
"body": "labs",
"userId": 10
}
'import requests
url = "http://localhost:8080/proxy"
payload = {
"title": "usher",
"body": "labs",
"userId": 10
}
headers = {
"T-PROXY-URL": "<t-proxy-url>",
"T-REQUEST-ID": "<t-request-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'T-PROXY-URL': '<t-proxy-url>',
'T-REQUEST-ID': '<t-request-id>',
'Content-Type': 'application/json'
},
body: JSON.stringify({title: 'usher', body: JSON.stringify('labs'), userId: 10})
};
fetch('http://localhost:8080/proxy', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/proxy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'usher',
'body' => 'labs',
'userId' => 10
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"T-PROXY-URL: <t-proxy-url>",
"T-REQUEST-ID: <t-request-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:8080/proxy"
payload := strings.NewReader("{\n \"title\": \"usher\",\n \"body\": \"labs\",\n \"userId\": 10\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("T-PROXY-URL", "<t-proxy-url>")
req.Header.Add("T-REQUEST-ID", "<t-request-id>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:8080/proxy")
.header("T-PROXY-URL", "<t-proxy-url>")
.header("T-REQUEST-ID", "<t-request-id>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"usher\",\n \"body\": \"labs\",\n \"userId\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/proxy")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["T-PROXY-URL"] = '<t-proxy-url>'
request["T-REQUEST-ID"] = '<t-request-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"usher\",\n \"body\": \"labs\",\n \"userId\": 10\n}"
response = http.request(request)
puts response.read_body{}Headers
Target URL to proxy the request to
Unique identifier for the proof request
Comma-separated list of fields to redact in format [req|res]:[body|header]:[field_name]
If present, proof generation will continue even for failed requests (status >= 400)
Body
application/json
The body is of type object.
Response
200 - application/json
Successful response from proxied endpoint with proof generation initiated
The response is of type object.
⌘I

