Skip to content

Commit d8d94fb

Browse files
author
Adam Tuttle
committed
Resolves Ticket #20; enables cross-domain access via a config setting.
1 parent c71ff10 commit d8d94fb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

core/api.cfc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@
138138
<cfsetting enablecfoutputonly="true" />
139139
<cfcontent reset="true" type="#application._taffy.settings.mimeExtensions[_taffyRequest.returnMimeExt]#" />
140140
<cfheader statuscode="#_taffyRequest.resultStatus#"/>
141+
<cfif application._taffy.settings.allowCrossDomain>
142+
<cfheader name="Access-Control-Allow-Origin" value="*" />
143+
</cfif>
141144
<cfif not structIsEmpty(_taffyRequest.resultHeaders)>
142145
<cfloop collection="#_taffyRequest.resultHeaders#" item="_taffyRequest.headerName">
143146
<cfheader name="#_taffyRequest.headerName#" value="#_taffyRequest.resultHeaders[_taffyRequest.headerName]#" />
@@ -172,6 +175,7 @@
172175
<cfset application._taffy.settings.dashboardKey = "dashboard"/>
173176
<cfset application._taffy.settings.disableDashboard = false />
174177
<cfset application._taffy.settings.unhandledPaths = "/flex2gateway" />
178+
<cfset application._taffy.settings.allowCrossDomain = false />
175179
<!--- allow setting overrides --->
176180
<cfset configureTaffy()/>
177181
<!--- translate unhandledPaths config to regex for easier matching (This is ripped off from FW/1. Thanks, Sean!) --->
@@ -580,6 +584,11 @@
580584
</cfif>
581585
</cffunction>
582586

587+
<cffunction name="enableCrossDomainAccess" access="public" output="false" returntype="void">
588+
<cfargument name="enabled" type="boolean" default="true" />
589+
<cfset application._taffy.settings.allowCrossDomain = arguments.enabled />
590+
</cffunction>
591+
583592
<cfif NOT isDefined("getComponentMetadata")>
584593
<cffunction name="tmp">
585594
<cfreturn getMetaData(createObject("component",arguments[1])) />

0 commit comments

Comments
 (0)