fake-s3 icon indicating copy to clipboard operation
fake-s3 copied to clipboard

CORS

Open MathewT opened this issue 10 years ago • 4 comments

Hello, Thanks for creating this project! Is there a way to configure fake-s3 so that it allows requests from all IP addresses? I noticed in server.rb response['Access-Control-Allow-Origin']='*'

My Javascript call to fake-s3 results in Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://172.17.42.1:4567/mb-cosmosproject-dev/0/0/4/0/0040b97f9310741fde6a634fa896d186/artifacts/pe_dump.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=foo%2F20150122%2Flocal-s3%2Fs3%2Faws4_request&X-Amz-Date=20150122T210522Z&X-Amz-Expires=3600&X-Amz-Signature=8e64a5cda541015eac8d92fcb25e1882a1b357f489a272379c21cf8caafc0bd7&X-Amz-SignedHeaders=Host. This can be fixed by moving the resource to the same domain or enabling CORS.

How can I allow fake-s3 to allow all origins?

Thanks, Mathew

MathewT avatar Jan 22 '15 21:01 MathewT

You doing a path based post request? I believe CORS is setup for a post request, but the detection is broken in master. I made a fork to get it working for me. I've had a pending pull request to fix this issue for the last year. No response from maintainer :( https://github.com/NickClark/fake-s3

NickClark avatar Feb 18 '15 12:02 NickClark

Nick, which pull request are you referring to? I see this one: https://github.com/jubos/fake-s3/pull/45, which I can merge into master, but not sure how those diffs would add CORS support.

In any case, CORS was added in v0.1.7, so @MathewT, let me know if fixes your issue.

jubos avatar Feb 18 '15 18:02 jubos

@jubos Correct, the CORS I needed had already been added. I just needed the request to be recognized as such, which is what #45 addressed.

NickClark avatar Feb 18 '15 19:02 NickClark

@jubos - can you please merge #45.

Had this exact issue this afternoon. Thanks 👍

revett avatar May 26 '16 17:05 revett