Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

367
Views
how to add missing CORS header ‘Access-Control-Allow-Origin’?

I want to get a base64 encoded image from another domain. I have enabled CORS on the backend but I am getting an error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://codedecoder.pythonanywhere.com/media/embed/2021/10/07/temp.jpg. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<img id="datadiv"></img>
var src = 'https://codedecoder.pythonanywhere.com/media/embed/2021/10/07/temp.jpg'

$.ajax({
  type: "GET",
  url: `https://codedecoder.pythonanywhere.com${src}`,
  crossDomain: true,
  success: function(dayta) {
    console.log(dayta);
    $('#datadiv')[0].src = dayta;
  },
})
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You set CORS headers on the server side. It's not a client side problem. But, for development purposes, you can use Chrome's CORS extension. Look it up on the chrome extension store.

about 4 years ago · Juan Pablo Isaza Report

0

For Django, check out the django-cors-headers package:

https://github.com/adamchainz/django-cors-headers

It is maintained by a member of the Django Software Foundation technical team.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!