Add support for fallback #19

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

baz44 commented Feb 28, 2013

This patch addresses a bug we found with our Backbone app. For Backbone
to set the cookie it requires non-wildcard CORS header to be returned,
but we also needed to support wildcard access for other clients.

So this patch adds fallback config parameter that if set allows
returning of explicit origin host for whitelisted domains, but that also
returns '*' header for other domains.

Also required test/unit in tests as tests didn't seem to run before.

Added support for fallback for white listed domains.
This patch addresses a bug we found with our Backbone app. For Backbone
to set the cookie it requires non-wildcard CORS header to be returned,
but we also needed to support wildcard access for other clients.

So this patch adds fallback config parameter that if set allows
returning of explicit origin host for whitelisted domains, but that also
returns '*' header for other domains.

Also required test/unit in tests as tests didn't seem to run before.

@cyu cyu closed this in 228d393 Jun 9, 2013

Owner

cyu commented Jun 9, 2013

Hi @baz44 - instead of taking in your PR, I went for another approach. It should still support your particular use case though (I used a modified version of your test to make sure). A 'fallback' option seemed too ambiguous, and final solution had an extra benefit of making the middleware more robust.

The downside of the solution is possibility of redundant configurations. I think this could be fixed in other ways though, and like to see some examples of this redundancy before coming up with a solution.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment