No 'Access-Control-Allow-Origin' header is present on the requested resource -- But it is?

My /etc/apache2/sites-enabled/richblockspoorblocks.com.conf on a remote server looks like this…

<VirtualHost *:80>
        ServerAdmin admin@richblockspoorblocks.com
        ServerName richblockspoorblocks.com
        ServerAlias images.richblockspoorblocks.com
        Header set Access-Control-Allow-Origin "*"
        DocumentRoot /home/rbpb/var/www/richblockspoorblocks.com/public_html/
        ErrorLog /home/rbpb/var/www/richblockspoorblocks.com/logs/error.log
        CustomLog /home/rbpb/var/www/richblockspoorblocks.com/logs/access.log combined
</VirtualHost>

I'm running a Django project on my local machine. The project makes a GET request to the remote server to read a JSON file: http://images.remote-server.com/dir/subdir/info.json

But I see this error in my browser's console.

Failed to load http://images.remote-server.com/dir/subdir/info.json: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8000' is therefore not allowed access.

I see nothing in my error.log.

How do I correctly set the 'Access-Control-Allow-Origin' in my .conf file?

1 Reply

Have you already implemented Django CORS Headers? What does your GET request look like?

More info

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct