cors issue with preflight request lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Packs · 2022-11-08 06:24 {$mode objfpc}{$H+} uses   {$ifdef UNIX}   cthreads, cmem,   {$endif}      fphttpapp, httpdefs, httproute, fpjson, jsonparser; procedure route1(aReq: TRequest; aResp: TResponse); var   s:string;   D,E : TJSONData; begin    writeln(areq.Content);    D:=GetJSON(areq.Content);    E:=d.FindPath('title');    s:=E.AsString; //   aResp.SetStatus(200);    aResp.Content:='

Route 1 respone:'+s+'

'; end; procedure route2(aReq: TRequest; aResp: TResponse); begin   aResp.Content:='

Route 2

'; end; begin   HTTPRouter.RegisterRoute('/', @route1);   HTTPRouter.RegisterRoute('/2', @route2);   Application.Port := 1999;   Application.Threaded := true;   Application.Initialize;   Application.Run; end.            when I run this code it is working in postman not working in browser . I am getting cors isssue . browse send the preflight request with "options" request . D:=GetJSON(areq.Content); the content is nil. getting CORS issue . ---------------------------------------------------------------------- PascalDragon · 2022-11-08 06:37 Please use [code=pascal][/code] tags so that the code is easier to see and isn't mangled by the forum software. ---------------------------------------------------------------------- Packs · 2022-11-08 08:01 it is solved   HTTPRouter.RegisterRoute('/2', rmPost,@route2); if we don't define method name browser will call preflight . it we define method name it will be called on specified method only .