Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to enable cors? #383

Closed
zaun opened this issue Feb 5, 2019 · 1 comment
Closed

Trying to enable cors? #383

zaun opened this issue Feb 5, 2019 · 1 comment

Comments

@zaun
Copy link

zaun commented Feb 5, 2019

I've got:

new S3rver({
  port: config.s3Port,
  hostname: 'localhost',
  silent: false,
  cors: '<CORSConfiguration><CORSRule><AllowedOrigin>*</AllowedOrigin><AllowedMethod>*</AllowedMethod><MaxAgeSeconds>3000</MaxAgeSeconds><AllowedHeader>*</AllowedHeader></CORSRule></CORSConfiguration>',
  directory: path.join(__dirname, 'temp', 's3'),
  removeBucketsOnClose: true
}).run((err, host, port) => {
  if(err) {
    return reject(err);
  }
  resolve();
});

but I keep getting:

Access to XMLHttpRequest at 'http://localhost:4569/media.las.com/temp/d43a4a8b-18fb-4920-986c-5801ef7fb52f?AWSAccessKeyId=key&Expires=1549339586&Signature=FLZdN5K6tWCLmSmu0VK7EdxadR8%3D&x-amz-acl=bucket-owner-full-control&x-amz-meta-mimetype=image%2Fpng&x-amz-meta-title=Test' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

@kherock
Copy link
Collaborator

kherock commented Feb 7, 2019

AllowedMethod can't be a wildcard, refer to the CORS docs here. I'd suggest you ensure that your config is valid on AWS before trying to use it locally, since it does report it as invalid.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants