Skip to content

Commit

Permalink
docs: Timeouts in CTP (#2710)
Browse files Browse the repository at this point in the history
* docs: Timeouts in CTP

Signed-off-by: zirain <zirain2009@gmail.com>

* Update site/content/en/latest/user/client-traffic-policy.md

Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* Update site/content/en/latest/user/client-traffic-policy.md

Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com>
Signed-off-by: zirain <zirain2009@gmail.com>

* update

Signed-off-by: zirain <zirain2009@gmail.com>

---------

Signed-off-by: zirain <zirain2009@gmail.com>
Co-authored-by: Arko Dasgupta <arkodg@users.noreply.github.com>
  • Loading branch information
zirain and arkodg authored Feb 28, 2024
1 parent 26d9d97 commit 8efa0d4
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions site/content/en/latest/user/client-traffic-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,5 +410,59 @@ Handling connection for 8888
}
```
### Enable HTTP Request Received Timeout
This feature allows you to limit the take taken by the Envoy Proxy fleet to receive the entire request from the client, which is useful in preventing certain clients from consuming too much memory in Envoy
This example configures the HTTP request timeout for the client, please check out the details [here](https://www.envoyproxy.io/docs/envoy/latest/faq/configuration/timeouts#stream-timeouts).
```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: ClientTrafficPolicy
metadata:
name: client-timeout
spec:
targetRef:
group: gateway.networking.k8s.io
kind: Gateway
name: eg
timeout:
http:
requestReceivedTimeout: 2s
EOF
```
Curl the example app through Envoy proxy:
```shell
curl -v http://$GATEWAY_HOST/get \
-H "Host: www.example.com" \
-H "Content-Length: 10000"
```
You should expect `428` response status after 2s:
```shell
curl -v http://$GATEWAY_HOST/get \
-H "Host: www.example.com" \
-H "Content-Length: 10000"
* Trying 172.18.255.200:80...
* Connected to 172.18.255.200 (172.18.255.200) port 80
> GET /get HTTP/1.1
> Host: www.example.com
> User-Agent: curl/8.4.0
> Accept: */*
> Content-Length: 10000
>
< HTTP/1.1 408 Request Timeout
< content-length: 15
< content-type: text/plain
< date: Tue, 27 Feb 2024 07:38:27 GMT
< connection: close
<
* Closing connection
request timeout
```
[ClientTrafficPolicy]: ../../api/extension_types#clienttrafficpolicy
[BackendTrafficPolicy]: ../../api/extension_types#backendtrafficpolicy

0 comments on commit 8efa0d4

Please sign in to comment.