Skip to content

Backbone.js and cross domain issues #106

Closed
@marbetschar

Description

@marbetschar

As I'm currently developing a backbone.js application based on a Taffy REST API, I'm facing again some "cross domain policy" issues.

The folowing changes in the taffy.core.api have solved my problems:

<cfset local.allowVerbs = uCase(structKeyList(_taffyRequest.matchDetails.methods)) />
<cfif application._taffy.settings.allowCrossDomain AND NOT listFind(local.allowVerbs,'OPTIONS')>
    <cfset local.allowVerbs = listAppend(local.allowVerbs,'OPTIONS') />
</cfif>

and

<cfif application._taffy.settings.allowCrossDomain>
    <cfheader name="Access-Control-Allow-Origin" value="*" />
    <cfheader name="Access-Control-Allow-Methods" value="#local.allowVerbs#" />
    <cfheader name="Access-Control-Allow-Headers" value="Content-Type" />
</cfif>

Additionally I would suggest to use local.allowVerbs anywhere where the allowed verbs are transmitted as a header field. I've changed the ALLOW header to use this variable too.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions