component { boolean function onRequestStart( required string targetPage ) { var headers = getHttpRequestData().headers; var origin = ''; var PC = getpagecontext().getresponse(); // Find the Origin of the request if( structKeyExists( headers, 'Origin' ) ) { origin = headers['Origin']; } // If the Origin is okay, then echo it back, otherwise leave out the header key if( listFindNoCase( 'http://www.mysite.com,http://mysite.com', origin ) { PC.setHeader( 'Access-Control-Allow-Origin', origin ); } // Only allow GET requests PC.setHeader( 'Access-Control-Allow-Methods', 'GET' ); return true; } }