Web server for ESP32 timing out

Do yourself a favour and start testing the IDE example "Webserver / Hello Server".
The "Webserver.h" will take over a lot of task from you.
For example the correct HTTP Header and HTTP Header Fields.

On the ESP32 (and ESP8266) it's seldom necessary to write the header in the user sketch (and by the way your header is not correct, HTTP/1.1 makes it mandatory to sent also the Content-Length, but you haven't added it to the header.)