You are not logged in.
Pages: 1
Good morning,
I am a beginner in Mormot,
I took the example:
mormot2\ex\Third Party Demos\martin-doyle\05-HttpDaemonORM,
and I added https, I changed:
On the server:
HttpServer := TRestHttpServer.Create(HttpPort,[SampleServer],'+',HTTP_DEFAULT_MODE,32,secTlsselfsigned );
On the client:
HttpClient := TRestHttpClient.Create('localhost', HttpPort, Model,true);
HttpClient.IgnoreTlsCertificateErrors:=true;
I ran Project05HttpDaemon.exe as administrator, it is registered in http.sys:
20241116 17291031 ! + mormot.rest.http.server.TRestHttpServer(016738e0).Create useHttpApiRegisteringURI (secTLSSelfSigned) on port 11111
20241116 17291033 ! http mormot.rest.http.server.TRestHttpServer(016738e0) http.sys registration of https://+:11111/root
20241116 17291033 " info SetThreadName 4c84=HttpSrv 11111root THttpApiSrv
20241116 17291033 " trace server.TSampleServer(01600030) BeginCurrentThread(THttpApiServer) root=root ThreadID=4c84 'HttpSrv 11111root THttpApiSrv' ThreadCount=1
20241116 17291033 # info SetThreadName 4f40=HttpSrv 11111root THttpApiSrv
But the client requests do not reach the server, there is not even a trace on the server.
THANKS.
Offline
Thank you for your response,
what is the best solution (security + speed) to resolve this problem,
with example if you like
THANKS
Offline
server:
HttpServer := TRestHttpServer.Create(HttpPort, [SampleServer], '+', useBidirAsync, 4, secTLSSelfSigned);
client:
HttpClient := TRestHttpClient.Create('localhost', HttpPort, Model, true);
Offline
Thank you for your response.
How can I do it with my own certificate with example please
THANKS
Offline
see source code:
/// create a HTTP/HTTPS Server instance, to serve REST requests
// - this is the easiest constructor to publish TRestServer(s) over HTTP/HTTPS
// - will create a TWebSocketAsyncServerRest, i.e. our useBidirAsync server
// which is available on all platforms, and supports TLS and WebSockets
// - specify one or several TRestServer server class(es) to be used: each
// class must have an unique Model.Root value, to identify which TRestServer
// instance must handle a particular request from its URI
// - port should specify the public server name or address to bind to: e.g.
// 'domainname:1234', '0.0.0.0:1234' for all addresses, '127.0.0.1:1234' for
// the TCP loopback, or 'unix:/path/to/myapp.socket' for the Unix domain
// sockets loopback - raises a ERestHttpServer exception if binding failed
// - the aThreadPoolCount parameter will set the number of threads
// to be initialized to handle incoming connections (default is a good 32)
// - for a HTTPS server, use secTLS and set CertificateFile, PrivateKeyFile,
// and PrivateKeyPassword expected values, or specify secTLSSelfSigned
// - see the overloaded constructors as alternatives with more options,
// e.g. if you want to use http.sys on Windows or TLS mutual auth callbacks
constructor Create(const aServers: array of TRestServer; const aPort: RawUtf8;
aThreadPoolCount: integer = 32; aSecurity: TRestHttpServerSecurity = secNone;
aOptions: TRestHttpServerOptions = HTTPSERVER_DEFAULT_OPTIONS;
const CertificateFile: TFileName = ''; const PrivateKeyFile: TFileName = '';
const PrivateKeyPassword: RawUtf8 = ''; const CACertificatesFile: TFileName = '');
reintroduce; overload;
Offline
Thanks for your help
i will test
Thanks
Offline
Pages: 1