FPHTTPserver with SSL lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- fpc2pas · 2022-05-04 09:17 I think recently there is an SSL support for fphttpserver, but I think the examples provided not really working, and tried to port something similar but also fails to generate or assign a self-signed cert, any ideas or demos? ---------------------------------------------------------------------- trev · 2022-05-04 10:04 See the example simpleserver in trunk's fpcsrc/fpc-3.3.1/packages/fcl- web/examples/simpleserver ---------------------------------------------------------------------- fpc2pas · 2022-05-04 10:16 Quote from: trev on May 04, 2022, 12:04:10 pmSee the example simpleserver in trunk's fpcsrc/fpc-3.3.1/packages/fcl- web/examples/simpleserver that example is not working in Linux, also not on windows 10, there is some other examples or more docs ? ---------------------------------------------------------------------- rvk · 2022-05-04 10:24 Quote from: fpc2pas on May 04, 2022, 12:16:49 pmQuote from: trev on May 04, 2022, 12:04:10 pmSee the example simpleserver in trunk's fpcsrc/fpc-3.3.1/packages/fcl-web/examples/simpleserver that example is not working in Linux, also not on windows 10, there is some other examples or more docs ? So for what platform is this example working? "Is not working" isn't really a problem description. Here is some more information. You could try to write your own (or explain more clearly what exactly "isn't working"). https://wiki.lazarus.freepascal.org/fpWeb_Tutorial ---------------------------------------------------------------------- zeljko · 2022-05-04 11:33 Quote from: fpc2pas on May 04, 2022, 11:17:35 amI think recently there is an SSL support for fphttpserver, but I think the examples provided not really working, and tried to port something similar but also fails to generate or assign a self-signed cert, any ideas or demos? I had similar problem, but now it works. I'm using synapse for ssl socket, just include opensslsockets into your lpr if you use synapse. Also, I'm using self signed certs for testing and it works. Of course, eg. curl refuse to establish such connection because of self signed certificates, but with --insecure option it works ok. Note: I've generated self signed certificates by using openssl under linux. EDIT:  This is how I've setted up https server certificates:     Application.UseSSL := True;     Application.CertificateData.HostName := MyWebServerConfig.CertificateHostName;     Application.CertificateData.KeyPassword:='';     Application.CertificateData.PrivateKey.FileName := MyWebServerConfig.CertificatePrivateKey;     Application.CertificateData.Certificate.FileName := MyWebServerConfig.CertificateCertificate; ---------------------------------------------------------------------- rvk · 2022-05-04 11:37 Quote from: zeljko on May 04, 2022, 01:33:16 pmNote: I've generated self signed certificates by using openssl under linux. You could also try to use Let’s Encrypt (when unencrypted works). ---------------------------------------------------------------------- fpc2pas · 2022-05-04 13:31 Quote from: rvk on May 04, 2022, 12:24:26 pmQuote from: fpc2pas on May 04, 2022, 12:16:49 pmQuote from: trev on May 04, 2022, 12:04:10 pmSee the example simpleserver in trunk's fpcsrc/fpc-3.3.1/packages/fcl- web/examples/simpleserver that example is not working in Linux, also not on windows 10, there is some other examples or more docs ? So for what platform is this example working? "Is not working" isn't really a problem description. Here is some more information. You could try to write your own (or explain more clearly what exactly "isn't working"). https://wiki.lazarus.freepascal.org/fpWeb_Tutorial it has been tested on Linux Mint, but as I said I got an error(connection reset ) from the browser while navigating to the server, tried to debug that with OpenSSL and i think that's due to failure to generate a self-signed cert while running or compiling. i think i will try to generate that manually first then inspect what's the reason for that ---------------------------------------------------------------------- fpc2pas · 2022-05-04 13:49 Quote from: zeljko on May 04, 2022, 01:33:16 pmQuote from: fpc2pas on May 04, 2022, 11:17:35 amI think recently there is an SSL support for fphttpserver, but I think the examples provided not really working, and tried to port something similar but also fails to generate or assign a self-signed cert, any ideas or demos? I had similar problem, but now it works. I'm using synapse for ssl socket, just include opensslsockets into your lpr if you use synapse. Also, I'm using self signed certs for testing and it works. Of course, eg. curl refuse to establish such connection because of self signed certificates, but with --insecure option it works ok. Note: I've generated self signed certificates by using openssl under linux. EDIT:  This is how I've setted up https server certificates:     Application.UseSSL := True;     Application.CertificateData.HostName := MyWebServerConfig.CertificateHostName;     Application.CertificateData.KeyPassword:='';     Application.CertificateData.PrivateKey.FileName := MyWebServerConfig.CertificatePrivateKey;     Application.CertificateData.Certificate.FileName := MyWebServerConfig.CertificateCertificate; yup that's worked for me i just created the cert manually and filled it, much thanks