Failed to connect to a simple web server lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- ap3000 · 2025-02-08 18:49 In preparation for making a Rest API webserver, I searched for some examples and found this one: https://medium.com/@marcusfernstrm/create-rest-apis-with- freepascal-441e4aa447b7 This compiling and running fine on my Windows 10 machine. But I just got a new laptop running Windows 11 and I can't connect to the server. I get the "ERR_CONNECTION_REFUSED". I have tried to shut off the firewall without a result. What can I more do to get this working? ---------------------------------------------------------------------- MarkMLl · 2025-02-08 18:55 I am no expert in this area, but in the interest of getting something going: is your client telling you that it wants https rather than http at the server end? MarkMLl ---------------------------------------------------------------------- ap3000 · 2025-02-08 19:26 Hi Mark, I'm not sure. It also doesn't with https. de server is only lisent to HTTP. As it works on Windows 10 it has to be something on this laptop. To exclude that it was the browser (Brave) I also tried it with Postman - same result Sorry I was not correct the error is "ERR_UNSAFE_REDIRECT" ---------------------------------------------------------------------- silvercoder70 · 2025-02-08 20:54 I suspect that it is forcing the browser to use https? The code does work out of the box - just ran it on linux mint and connected fine via Firefox. Try out this link ... https://superuser.com/questions/1400200/chrome-persistently- redirecting-to-https-for-http-site ---------------------------------------------------------------------- egsuh · 2025-02-09 07:26 I don't think this is the cause of the problem, but is port 8090 available? ---------------------------------------------------------------------- jcmontherock · 2025-02-09 09:54 Did you change the port in file ? 8090 or 9080 ---------------------------------------------------------------------- ap3000 · 2025-02-09 20:19 Hi @jcmontherock Yes I changed the port to 9080 and No @egsuh, the 9080 port is available -  checked with netstat -an. But the netstat shows it as Local address 127.0.0.1:9080 and foreign address 127.0.0.1:49258 CLOSE_WAIT. But also as Local address 127.0.0.1:9080 and foreign address 0.0.0.0 LISTENING. See screen shots Can someone tell me what it's mean? But changed the port to 9081 and now it is working. ---------------------------------------------------------------------- MarkMLl · 2025-02-09 20:53 It means that something's connected to it (not necessarily successfully) and that the port doesn't have the option set that allows immediate reconnection. This is something that I've previously wrestled with in the context of LNet's Telnet implementation, which was so screwed up that I ended up writing my own: see https://github.com/MarkMLl/telnetsrv/blob/main/telnetserver.pas line 888. MarkMLl ---------------------------------------------------------------------- ap3000 · 2025-02-09 20:58 Thanks Mark ---------------------------------------------------------------------- MarkMLl · 2025-02-09 21:16 BTW, kudos to you for using netstat properly ;-) MarkMLl