I found a solution and so far works fine:
Code:
procedure TIWServerController.IWServerControllerBaseNewSession(aSession: TIWApplication);
var
challengeResponse, challengeFileName: string;
begin
[...]
else if ContainsText(WebApplication.Request.PathInfo, '.well-known/acme-challenge') then
begin
// for let's encrypt
challengeFileName := WebApplication.ApplicationPath + 'wwwroot' + WebApplication.Request.PathInfo.Replace('/', '\');
if TFile.Exists(challengeFileName) then
challengeResponse := TFile.ReadAllText(challengeFileName)
else
challengeResponse := '';
WebApplication.Response.WriteString(challengeResponse);
WebApplication.Terminate;
end;
end;