Weird, your code looks OK other than not zero'ing app_hint (probably done outside the code).
It is also possible that the first byte is a null character and you can print more data by doing something like
std::string_view(buffer, n)
, but I don't think that is valid html.
It may also be possible your buffer size is too big and the reason why it worked in localhost was because the max packet size is 63000, but then again, your packet size is 1 million bytes long.
I assume this code is for a server, since you are binding and listening, but your explanation confuses me since you have a browser, but to me it looks like just an echo server.
The only weird thing is that you are specifying and converting localhost as the IP, but you can also use
htonl(INADDR_ANY)
, not sure if that is the source of the problem, but your comment also says
//0.0.0.0 -> any address in this machine
, but your actual code is different (0.0.0.0 is INADDR_ANY).
If that doesn't help, from my knowledge when you deal with http you should use libcurl, so perhaps that could maybe help you, and could solve some problems in the long run.
I think this prints out the whole html document
https://curl.haxx.se/libcurl/c/getinmemory.html
And for getting just the GET feedback you can combine the above with this.
https://curl.haxx.se/libcurl/c/CURLOPT_HTTPGET.html
I don't use curl but that should be the general gist of it.