# CORB error

**URL:** https://forum.infinityfree.com/t/corb-error/75158
**Category:** Hosting Support
**Created:** [April 22, 2023, 8:22pm UTC](https://forum.infinityfree.com/t/corb-error/75158 "2023-04-22T20:22:18Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![anon20224786](https://forum.infinityfree.com/letter_avatar/anon20224786/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon20224786](https://forum.infinityfree.com/u/anon20224786)
#### Post date: [April 22, 2023, 8:22pm UTC](https://forum.infinityfree.com/t/corb-error/75158/1 "2023-04-22T20:22:18Z")

</div>

# 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:

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

```

## JS:

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

```

That’s my code.

---

<div class="post-metadata">

### Author: ![Greenreader9](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/greenreader9/32/22847_2.png) [@Greenreader9](https://forum.infinityfree.com/u/Greenreader9)
#### Post date: [April 22, 2023, 8:37pm UTC](https://forum.infinityfree.com/t/corb-error/75158/2 "2023-04-22T20:37:37Z")

</div>

> [@anon20224786](#):
>
> when making a request using `fetch` with javascript gives me an error saying something from CORB

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

> [@Ensuring only web browsers can access your website](https://forum.infinityfree.com/t/ensuring-only-web-browsers-can-access-your-website/49353):
>
> InfinityFree is a website hosting service. That means that the hosting accounts we provided are intended for hosting websites. Websites contain pages that are accessed through web browsers. InfinityFree is not intended to be used for file sharing, API hosting, database hosting or background tasks/tools. To help enforce this, free hosting enforces a security system that makes sure that anyone trying to access your website is using a normal web browser. This is done by checking whether the web br…

---

<div class="post-metadata">

### Author: ![anon20224786](https://forum.infinityfree.com/letter_avatar/anon20224786/32/5_5575768a8748004e209b776fc1b2916d.png) [@anon20224786](https://forum.infinityfree.com/u/anon20224786)
#### Post date: [April 22, 2023, 9:44pm UTC](https://forum.infinityfree.com/t/corb-error/75158/3 "2023-04-22T21:44:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)
#### Post date: [April 29, 2023, 9:44pm UTC](https://forum.infinityfree.com/t/corb-error/75158/4 "2023-04-29T21:44:24Z")

</div>

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