plantuml
@startuml
actor Client
participant "TLS Proxy" as Proxy
participant "API Gateway" as Gateway
participant "API Service" as API
Client -> Proxy: TLS 1.3 ClientHello\nwith 0-RTT data\nPOST /api/v1/resource
Proxy -> Proxy: Accept 0-RTT data\n(before TLS handshake complete)
Proxy -> Gateway: POST /api/v1/resource\nEarly-Data: 1\n[request body]
Gateway -> Gateway: Detect Early-Data header\nCheck HTTP method
alt Non-idempotent method (POST, PUT, DELETE)
Gateway --> Proxy: 425 Too Early\nReject replay-vulnerable request
Proxy --> Client: 425 Too Early
Client -> Proxy: Retry POST without 0-RTT\n(full TLS handshake)
Proxy -> Gateway: POST /api/v1/resource\n(no Early-Data header)
Gateway -> API: Process request
API --> Gateway: 200 OK
Gateway --> Proxy: 200 OK
Proxy --> Client: 200 OK
else Idempotent method (GET, HEAD, OPTIONS)
Gateway -> API: Process request\n(safe for replay)
API --> Gateway: 200 OK
Gateway --> Proxy: 200 OK
Proxy --> Client: 200 OK
end
note right
0-RTT saves one round-trip
but requires careful replay
protection for state-changing
operations
end note
@enduml