Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CORS Problem with option request
#2
Hi Ronald, I have been getting good results in situations like yours, using .OnAfterDispach
Code:
procedure TIWServerController.IWServerControllerBaseAfterDispatch(
  Request: THttpRequest; aReply: THttpReply);
begin
   aReply.AddHeader('Content-Security-Policy',
      'default-src '       + QuotedStr('self') + ' https: ' + QuotedStr('unsafe-inline') + ' ' + QuotedStr('unsafe-eval') + '; ' +
      'script-src '        + QuotedStr('self') + ' https: ' + QuotedStr('unsafe-inline') + ' ' + QuotedStr('unsafe-eval') + '; ' +
      'style-src '         + QuotedStr('self') + ' https: ' + QuotedStr('unsafe-inline') + '; ' +
      'img-src '           + QuotedStr('self') + ' https: data:; ' +
      'object-src '        + QuotedStr('self') + '; ' +
      'media-src '         + QuotedStr('self') + ' https:; ' +
      'frame-ancestors '   + QuotedStr('self') + ' https:; ' +
      'base-uri '          + QuotedStr('self') + ' https:');

   aReply.AddHeader('Access-Control-Allow-Origin', '*');
end;
Reply


Messages In This Thread
RE: CORS Problem with option request - by Jose Nilton Pace - 08-19-2021, 12:36 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)