Keep Alive timeout for http server

345 views
Skip to first unread message

sreekanth guru

unread,
Aug 20, 2023, 2:10:19 AM8/20/23
to ve...@googlegroups.com
Hi all,

I have enabled TCP keep-alive timeout for vert.x http server using the following setting.

httpServerOptions.setTcpKeepAlive(true);

But When I make a curl request, the response doesn't have the keep alive information. POST 'http://localhost:8080/<path>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
    "text": "same text"
}'
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST <path> HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.1.2
> Accept: */*
> Authorization: Bearer <token>
> Content-Type: application/json
> Content-Length: <length>
>
< HTTP/1.1 200 OK
< content-type: application/json
< content-length: 2
<
* Connection #0 to host localhost left intact
{}%  
The above response is from vert.x server, it doesn't have "connection: keep-alive", could you please let me know if I am missing something.

Thank you.
-Sreekanth

sreekanth guru

unread,
Aug 20, 2023, 2:12:21 AM8/20/23
to ve...@googlegroups.com
One more doubt, how to set keep-alive timeout for http server, I don't see an option to set it.

Thank you.
-Sreekanth


Bruno F

unread,
Aug 20, 2023, 7:45:32 AM8/20/23
to vert.x
Tcp keep alive  and http keep alive are different things. 
The latter is enabled by default.
There is a setidletimeout method on httpserveroptions but I'm not sure it will wait for the server to process the request. 

Bruno.
Reply all
Reply to author
Forward
0 new messages