# The CORS Problems

**URL:** <https://forum.infinityfree.com/t/the-cors-problems/70610>\
**Category:** Hosting Support\
**Created:** [January 6, 2023, 8:20am UTC](https://forum.infinityfree.com/t/the-cors-problems/70610 "2023-01-06T08:20:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon35000418](https://forum.infinityfree.com/letter_avatar/anon35000418/32/6_22734026db12803ebb3e059622ac3534.png) [@anon35000418](https://forum.infinityfree.com/u/anon35000418)\
**Post date:** [January 6, 2023, 8:20am UTC](https://forum.infinityfree.com/t/the-cors-problems/70610/1 "2023-01-06T08:20:08Z")

</div>

Hello,  
I used the blog. subdomain to build my own personal blog on the wordpress platform.At the same time, in the main website (main domain) written by html, I set up a page in it to display all the articles in WordPress.The access method is apjx, and the url is  
` blog.example.com/wp-json/wp/v2/posts?per_page=10&page=1&_fields=title,link,date`;  
However, I encountered a CORS error.The error message of the browser is  
` **blocked by CORS policy: No 'Access Control Allow Origin' header** `  
Both of the above websites are hosted on Infinityfree. I’ve used most of the .htacess or php methods on the Internet, but they don’t seem to work.  
How can I get rid of this damn CORS error？  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [January 6, 2023, 9:44am UTC](https://forum.infinityfree.com/t/the-cors-problems/70610/2 "2023-01-06T09:44:55Z")

</div>

> [@anon35000418](#):
>
> How can I get rid of this damn CORS error？

Upgrade to premium hosting?  
This is the limitation of free hosting

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [January 6, 2023, 10:30am UTC](https://forum.infinityfree.com/t/the-cors-problems/70610/3 "2023-01-06T10:30:03Z")

</div>

Unfortunately, CORS or embedding resources from domains hosted on our free hosting is not impossible. This also applies if they use the same base domain or are using the same account.

> [@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…

One workaround could be to migrate your website from a subdomain to a subdirectory. Suppose that right now, you have WordPress on [blog.example.com](http://blog.example.com) and your HTML site on [example.com](http://example.com). You could choose to migrate your WordPress site to [example.com/blog/](http://example.com/blog/), and have your Javascript code point to that. Since they use the same domain ([example.com](http://example.com)), you don’t have this limitation.

---

<div class="post-metadata">

**Author:** ![anon35000418](https://forum.infinityfree.com/letter_avatar/anon35000418/32/6_22734026db12803ebb3e059622ac3534.png) [@anon35000418](https://forum.infinityfree.com/u/anon35000418)\
**Post date:** [January 6, 2023, 4:40pm UTC](https://forum.infinityfree.com/t/the-cors-problems/70610/4 "2023-01-06T16:40:25Z")

</div>

OK，Thank you!

---

<div class="post-metadata">

**Author:** ![anon35000418](https://forum.infinityfree.com/letter_avatar/anon35000418/32/6_22734026db12803ebb3e059622ac3534.png) [@anon35000418](https://forum.infinityfree.com/u/anon35000418)\
**Post date:** [January 6, 2023, 4:41pm UTC](https://forum.infinityfree.com/t/the-cors-problems/70610/5 "2023-01-06T16:41:40Z")

</div>

Okay, I already know,Thanks!

---

<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:** [January 13, 2023, 4:42pm UTC](https://forum.infinityfree.com/t/the-cors-problems/70610/6 "2023-01-13T16:42:30Z")

</div>

Closed on January 13, 2023, 4:42pm UTC

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