Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Http.sys questions
#7
Thanks Kudzu for your feedback! Yes, we do have wildcard SSL certificates for the cases I am looking at. I did some experiments on my own earlier and could successfully redirect from my main web application to a couple of other web applications, so for those I do not need any other solution as it looks like. This is my test code (hard-coded values will be replaced by values read from configuration if I complete this code):

Code:
procedure TBaseClientServerController.IWServerControllerBaseExecuteRequest(const Url: string;
  Request: THttpRequest; aReply: THttpReply; var Handled: Boolean);

  procedure CheckForOldHostToRedirect(const OldHost, RedirectBaseUrl: string);
  var
    RedirectUrl: string;
  begin
    if ContainsText(Request.Host, OldHost) then
    begin
      RedirectUrl := RedirectBaseUrl + Request.PathInfo;
      if Request.Query <> EmptyStr then
        RedirectUrl := RedirectUrl + '?' + Request.Query;
      ReportInformation(SafeFormat('Host contains %s, redirecting to %s...', [OldHost, RedirectUrl]));
      aReply.SendRedirect(RedirectUrl, 301);
      Handled := True;
    end;
  end;

const
  HostCount = 2;
  OldHosts: array[1..HostCount] of string = ('m.mydomain.com', 'recipient.mydomain.com');
  RedirectBaseUrls: array[1..HostCount] of string = ('https://mydomain.com/m', 'https://mydomain.com/recipient');
var
  i: Integer;
begin
  for i := 1 to HostCount do
  begin
    CheckForOldHostToRedirect(OldHosts[i], RedirectBaseUrls[i]);
    if Handled then
      Break;
  end;
end;

Please let me know if I should do this differently from within my IntraWeb application. We are investigating some other external solution for our non-intraweb applications, as it turns out that some existing clients for these services do not handle redirects properly.

Best regards

Magnus Oskarsson

PS. My other questions above remain.
Reply


Messages In This Thread
Http.sys questions - by magosk - 11-30-2021, 03:52 PM
RE: Http.sys questions - by Jose Nilton Pace - 11-30-2021, 04:51 PM
RE: Http.sys questions - by Alexandre Machado - 12-02-2021, 08:43 AM
RE: Http.sys questions - by magosk - 12-02-2021, 09:04 AM
RE: Http.sys questions - by magosk - 12-07-2021, 12:52 PM
RE: Http.sys questions - by kudzu - 12-17-2021, 07:22 PM
RE: Http.sys questions - by magosk - 12-20-2021, 10:17 AM
RE: Http.sys questions - by kudzu - 12-20-2021, 08:47 PM
RE: Http.sys questions - by magosk - 12-21-2021, 06:51 AM
RE: Http.sys questions - by Alexandre Machado - 01-12-2022, 08:34 PM
RE: Http.sys questions - by Alexandre Machado - 01-12-2022, 08:43 PM
RE: Http.sys questions - by magosk - 01-13-2022, 07:20 AM
RE: Http.sys questions - by Alexandre Machado - 01-19-2022, 06:20 AM
RE: Http.sys questions - by DanBarclay - 01-22-2022, 11:00 PM
RE: Http.sys questions - by magosk - 01-24-2022, 02:10 PM
RE: Http.sys questions - by magosk - 01-26-2022, 04:08 PM
RE: Http.sys questions - by Alexandre Machado - 01-27-2022, 04:16 AM
RE: Http.sys questions - by magosk - 01-27-2022, 07:45 AM
RE: Http.sys questions - by Alexandre Machado - 01-27-2022, 09:18 PM
RE: Http.sys questions - by magosk - 01-28-2022, 06:32 AM
RE: Http.sys questions - by magosk - 01-27-2022, 12:21 PM
RE: Http.sys questions - by Alexandre Machado - 01-27-2022, 09:19 PM
RE: Http.sys questions - by magosk - 01-31-2022, 12:42 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)