Browse Source

* Better CORS handling: return origin if available and allowed domains not set (fix compilation)

git-svn-id: trunk@42296 -
michael 6 years ago
parent
commit
2b8595d9da
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/fcl-web/src/restbridge/sqldbrestbridge.pp

+ 2 - 2
packages/fcl-web/src/restbridge/sqldbrestbridge.pp

@@ -1666,7 +1666,7 @@ begin
     end
     end
   else
   else
     begin
     begin
-    IO.Response.SetCustomHeader('Access-Control-Allow-Origin',ResolvedCORSAllowedOrigins);
+    IO.Response.SetCustomHeader('Access-Control-Allow-Origin',ResolvedCORSAllowedOrigins(IO.Request));
     S:=IO.Resource.GetHTTPAllow;
     S:=IO.Resource.GetHTTPAllow;
     IO.Response.SetCustomHeader('Access-Control-Allow-Methods',S);
     IO.Response.SetCustomHeader('Access-Control-Allow-Methods',S);
     IO.Response.SetCustomHeader('Access-Control-Allow-Headers','x-requested-with, content-type, authorization');
     IO.Response.SetCustomHeader('Access-Control-Allow-Headers','x-requested-with, content-type, authorization');
@@ -1706,7 +1706,7 @@ begin
         Conn.OnLog:[email protected];
         Conn.OnLog:[email protected];
         end;
         end;
       if (rdoHandleCORS in DispatchOptions) then
       if (rdoHandleCORS in DispatchOptions) then
-        IO.Response.SetCustomHeader('Access-Control-Allow-Origin',ResolvedCORSAllowedOrigins);
+        IO.Response.SetCustomHeader('Access-Control-Allow-Origin',ResolvedCORSAllowedOrigins(IO.Request));
       if not AuthenticateRequest(IO,True) then
       if not AuthenticateRequest(IO,True) then
         exit;
         exit;
       if Not CheckResourceAccess(IO) then
       if Not CheckResourceAccess(IO) then