7
My application uses a Bucket on AWS to host the static and MEDIA files, here’s the link: http://memoriasclubeturismoenv.us-east-2.elasticbeanstalk.com/gilson-rolim-02-12-2019 or https://memorias.clubeturismo.com.br/gilson-rolim-02-12-2019
In my application I use a plugin called "Dearflip".
The problem is that, for some reason, even configuring CORS in Bucket, still gives problem when running the plugin.
The error is this: Access to image at 'https://media-memorias.s3.amazonaws.com/media/models/Capa_mvd8KiC.png' from origin 'http://memoriasclubeturismoenv.us-east-2.elasticbeanstalk.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested Resource.
I added the following to Bucket:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Does anyone have any idea how to solve this mystery?
Tried using https://pypi.org/project/django-cors-headers/ ?
– Guilherme Nascimento
Yes, but it didn’t work, unfortunately :(
– Victor Fernandes
But you just installed and didn’t do the config
CORS_ORIGIN_WHITELIST
? If not apply it does nothing– Guilherme Nascimento
Yes, I added the Hots to CORS_ORIGIN_WHITELIST but it didn’t work :(
– Victor Fernandes
The error is: Access to image at 'https://media-memorias.s3.amazonaws.com/media/models/Capa_bRI7lVR.png' from origin 'https://memorias.clubeturismo.com.br' has been blocked by CORS policy: No 'Access-Control-Present-Allow-Origin' header is on the requested Resource. Currently Django-Cors-headers is on
– Victor Fernandes
Looking at it, I don’t think it’s going to work, give me one: https://github.com/bradleyg/django-s3direct#access-setup
– Guilherme Nascimento