CORB error

I need to create an API

I used header('Access-Control-Allow-Origin: *') in api.php and when making a request using fetch with javascript gives me an error saying something from CORB, how do I fix it?

PHP:

header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
echo '{"message":"hello"}';

JS:

fetch('example.infinityfreeapp.com').then(res=>res.json()).then(data=>{
console.log(data);
});

That’s my code.

Without more detail, my assumption is that the request is getting blocked by this system:

4 Likes

Yeah, right now I just read that it wasn’t possible, so it’s a concern not being able to make an API, I understand that it’s for security, but it’s annoying, I have to agree that infinityfree is free, for which I appreciate

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.