Browse Source

* Merging revisions r44303 from trunk:
------------------------------------------------------------------------
r44303 | michael | 2020-03-15 20:30:34 +0100 (Sun, 15 Mar 2020) | 1 line

* Fixes in CORS handling
------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@46580 -

michael 5 years ago
parent
commit
c6fafb7325
1 changed files with 4 additions and 1 deletions
  1. 4 1
      packages/fcl-web/src/restbridge/sqldbrestbridge.pp

+ 4 - 1
packages/fcl-web/src/restbridge/sqldbrestbridge.pp

@@ -1714,7 +1714,10 @@ begin
         Conn.OnLog:[email protected];
         end;
       if (rdoHandleCORS in DispatchOptions) then
+        begin
         IO.Response.SetCustomHeader('Access-Control-Allow-Origin',ResolvedCORSAllowedOrigins(IO.Request));
+        IO.Response.SetCustomHeader('Access-Control-Allow-Credentials',BoolToStr(CORSAllowCredentials,'true','false'));
+        end;
       if not AuthenticateRequest(IO,True) then
         exit;
       if Not CheckResourceAccess(IO) then
@@ -2008,7 +2011,7 @@ begin
       IO.RestOutput.InitStreaming;
       IO.RestInput.InitStreaming;
       IO.OnSQLLog:[email protected];
-      if AuthenticateRequest(IO,False) then
+      if SameText('OPTIONS',aRequest.Method) or AuthenticateRequest(IO,False) then
         DoHandleRequest(IO)
     except
       On E : Exception do