mardi 24 février 2015

DynamoDB Local Access-Control-Allow-Origin

I'm trying to develop an app (on http://whatever.dev for example) that will, once in production, use AWS DynamoDB with JavaScript (not Node). For now, we're using DynamoDB Local to be able to dev locally without hitting AWS.


The problem with DynamoDB Local is that there's no provided Access-Control-Allow-Origin header sent back from the server.


So if I do this on whatever.dev:



var dynamodb = new AWS.DynamoDB({
accessKeyId: 'thisIsSomeInvalidKey',
secretAccessKey:'anEquallyInvalidSecret!',
region: 'us-east-1',
endpoint: 'http://ift.tt/18hRPIj',
sslEnabled: false,
maxRetries: 5,
//logger: console
});

dynamodb.listTables(function(err, data) {
console.log(data)
});


This is what I get back:


XMLHttpRequest cannot load whatever.dev:8000. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'whatever.dev' is therefore not allowed access.


So, essentially, I'm developing locally, using DynamoDB Local yet I can't connect to it because it doesn't give me XHR allowance. Is there any way around this? Can I modify something in DynamoDB Local to obtain the proper headers?


There are no Python/Java dependencies to my project (it's purely front-end, with Backbone and RequireJS), so using one would suck.


Thanks!





Aucun commentaire:

Enregistrer un commentaire