This example demonstrates how to enable and configure SSL (HTTPS) in a Dext Web application.
- Dext.inc: Ensure
DEXT_ENABLE_SSLis defined inSources\Dext.inc. - Libraries:
- For OpenSSL (Default): You need
libeay32.dllandssleay32.dll(OpenSSL 1.0.2u or compatible) in your application's folder. - For Taurus TLS: You need the Taurus TLS libraries and correct OpenSSL 1.1.x/3.x DLLs as specified by the Taurus project. Ensure
DEXT_ENABLE_TAURUS_TLSis defined inDext.inc.
- For OpenSSL (Default): You need
- Certificates: You need a certificate file (
.crtor.pem) and a private key file (.key). For local testing, you can generate self-signed ones.
SSL is configured via the Server section in appsettings.json:
{
"Server": {
"Port": 8080,
"UseHttps": "true",
"SslProvider": "OpenSSL",
"SslCert": "server.crt",
"SslKey": "server.key",
"SslRootCert": ""
}
}UseHttps:trueto enable SSL,falsefor HTTP only.SslProvider:OpenSSL(Default): Uses Indy's native OpenSSL 1.0.x implementation.Taurus: Uses the Taurus TLS implementation (supports OpenSSL 1.1x / 3.x).
SslCert: Path to your certificate file.SslKey: Path to your private key file.SslRootCert: (Optional) Path to the root certificate/bundle.
You can use OpenSSL to generate a self-signed certificate for testing:
openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -nodes- Build the project.
- Ensure the DLLs and
.crt/.keyfiles are in the same directory as the executable. - Run the application.
- Access
https://localhost:8080.
- Means the server closed connection during handshake.
- Check if you have valid certificates.
- Check if
server.crtandserver.keymatch.
- Common issue with OpenSSL DLL incompatibility.
- Solution: Ensure you are using OpenSSL 1.0.2u DLLs (
libeay32.dll,ssleay32.dll) in the same folder as the executable. - Note: Standard Indy does NOT support OpenSSL 1.1.x or 3.x.
To use modern OpenSSL versions, switch to Taurus TLS provider:
- Ensure
DEXT_ENABLE_TAURUS_TLSis defined inDext.inc. - Install Taurus TLS library in Delphi.
- Update
appsettings.json:"SslProvider": "Taurus"
- Use OpenSSL 1.1.x or 3.x DLLs (
libcrypto-*.dll,libssl-*.dll).
-
ERR_SSL_PROTOCOL_ERROR / ERR_TIMED_OUT: Some combinations of Windows/Indy/OpenSSL DLLs may fail the handshake even with correct configuration. This is often due to strict TLS version mismatch or DLL architecture mismatch (32 vs 64 bit).
-
If you encounter persistent issues, try testing with the Taurus TLS provider which allows using modern, supported OpenSSL versions.
-
Web.JwtAuthDemo - JWT Authentication example