And finally the content of the CORS.ini file

http://glctracker.golf-loisir-club.com/gps/
origin = *
methods = GET, POST, PUT, DELETE


And our version of the A4D_PostExecuteHook, implemented to workaround the
OPTIONS issue (401)

//METHOD: A4D_PostExecuteHook(
  //                 ioResponseHeaderNames: ->Text Array;
  //                 ioResponseHeaderValues: ->Text Array;
  //                 ioResponse: ->BLOB;
  //
  //Part of Active4D, the ultimate 4D web environment
  //Copyright © Aparajita Fishman, All Rights Reserved

C_POINTER($1;$ioResponseHeaderNames;$2;$ioResponseHeaderValues;$3;$ioRespon
se)
$ioResponseHeaderNames:=$1
$ioResponseHeaderValues:=$2
$ioResponse:=$3
C_TEXT($4;$url)
$url:=$4

  //----------------------------------------------------------------
  //Modify the headers or response here
  //----------------------------------------------------------------

If (Position("/GPS/";$url)>0)
 APPEND TO ARRAY($ioResponseHeaderNames->;"Access-Control-Allow-Origin")
 APPEND TO ARRAY($ioResponseHeaderValues->;"*")
 APPEND TO ARRAY($ioResponseHeaderNames->;"Access-Control-Allow-Headers")
 APPEND TO ARRAY($ioResponseHeaderValues->;"content-type")
 APPEND TO ARRAY($ioResponseHeaderNames->;"Access-Control-Allow-Methods")
 APPEND TO ARRAY($ioResponseHeaderValues->;"GET,POST,PUT,DELETE")
 APPEND TO ARRAY($ioResponseHeaderNames->;"Access-Control-Max-Age")
 APPEND TO ARRAY($ioResponseHeaderValues->;"10")
End if 

  //----------------------------------------------------------------
  //If you modify ioResponse, change if (False) in the next line to if
(True)
  //----------------------------------------------------------------
If (False)
 C_LONGINT($index)
 $index:=Find in array($ioResponseHeaderNames->;"Content-Length")

 If ($index>0)
 $ioResponseHeaderValues->{$index}:=String(BLOB size($ioResponse->))
 End if 
End if 

Its invocation in A4D_onWebConnection has modified to pass the url as 4th
parm

A4D_PostExecuteHook
(->$responseHeaderNames;->$responseHeaderValues;->$response;$1)






-- 
Robert Ernens
HCTBA Consulting
Look2BookOnline - Web-à-la-Carte
4 Rés. Les Bois du Cerf
91450 Etiolles
Tél.: +33.950.58.95.80
GSM : +33.611.78.44.68


_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/

Reply via email to