06-08-2018, 02:56 PM
Hello Guys,
I am trying to do a service that works under ssl, but that I redirect the http connections to https and I have not succeeded. Is it possible to do that?
I need to use port 9001 so I also can not bind on two different ports, so I need only redirect https:\\example.com to https:\\example.com.
My implementation:
and
Thank you!
I am trying to do a service that works under ssl, but that I redirect the http connections to https and I have not succeeded. Is it possible to do that?
I need to use port 9001 so I also can not bind on two different ports, so I need only redirect https:\\example.com to https:\\example.com.
My implementation:
Code:
sslHandler := TIdServerIOHandlerSSLOpenSSL.Create(nil);
sslHandler.SSLOptions.KeyFile := GetCurrentDir + '\certificados\private.key';
sslHandler.SSLOptions.CertFile := GetCurrentDir + '\certificados\certificate.crt';
sslHandler.SSLOptions.RootCertFile := GetCurrentDir + '\certificados\ca_bundle.crt';
sslHandler.SSLOptions.Mode := sslmServer;
sslHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvSSLv2, sslvSSLv23, sslvSSLv3, sslvTLSv1_1, sslvTLSv1_2];
sslHandler.SSLOptions.VerifyDepth := 0;
sslHandler.SSLOptions.VerifyMode := [];
sslHandler.OnGetPassword := IdServerIOHandlerSSLOpenSSLGetPassword;
Server.OnConnect := onConect;
Server.IOHandler := sslHandler;
and
Code:
if (AContext.Connection.IOHandler is TIdSSLIOHandlerSocketBase) then
TIdSSLIOHandlerSocketBase(AContext.Connection.IOHandler).PassThrough:= False;
Thank you!