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

287
Views
My website has been blocked by CORS policy

The error I am encountering in the console browser is:

Access to fetch at 'https://website.com/api/imtryingtofetchhere' from origin 
'https://mywebsite.com' 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. If an opaque response serves your
needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I already tried a lot of methods everything i saw marked as "correct" here in StackOverFlow, however nothing works. I already tried method using AXIOS before using fetch and still no luck of work. API is working on website like https://reqbin.com and I am now clueless on how to fix this thing.

Things that i've tried fetch & axios and other:

  • Adding/Removing allowed cross origin
  • with/without certificates
  • include/not include credentials
  • Disabled/Enabled CORS
  • Adding Head
  • Tried to add origin to .htaccess and php file still no hope

I also tried both of Axios link

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

Using unpkg CDN:

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

This is working on my discord bot, but on my website it doesn't work...

JS Code from my discord bot:

const hashToMintme = await axios.get(
  `https://www.coinimp.com/api/v2/payout/1mhash?currency=MINTME`,
  {
    headers: {
      'X-API-ID': 'API ID HERE',
      'X-API-KEY': 'API KEY HERE',
    },
  }
);

JS Code from my php website:

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
    const axios = require('axios');

    const hashToMintme = await axios.get(`https://www.coinimp.com/api/v2/payout/1mhash?currency=MINTME`, {
        headers: {
            'X-API-ID': 'API ID HERE',
            'X-API-KEY': 'API KEY HERE'
        }
    });
</script>

This is the fetch code:

let headers = {
  'X-API-ID': 'API ID HERE',
  'X-API-KEY': 'API KEY HERE',
};

const hashToMintme = fetch(
  `https://www.coinimp.com/api/v2/payout/1mhash?currency=MINTME`,
  {
    mode: 'cors',
    credentials: 'include',
    method: 'GET',
    headers: headers,
  }
);

I didn't include the other settings since they are useless and not working.

about 4 years ago · Juan Pablo Isaza
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!