# CORS issue

**URL:** <https://forum.infinityfree.com/t/cors-issue/92388>\
**Category:** Hosting Support\
**Created:** [April 16, 2024, 7:30am UTC](https://forum.infinityfree.com/t/cors-issue/92388 "2024-04-16T07:30:04Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon18889275](https://forum.infinityfree.com/letter_avatar/anon18889275/32/6_449c533f586939b6e5f246632a46421f.png) [@anon18889275](https://forum.infinityfree.com/u/anon18889275)\
**Post date:** [April 16, 2024, 7:30am UTC](https://forum.infinityfree.com/t/cors-issue/92388/1 "2024-04-16T07:30:04Z")

</div>

[https://webchatter.000.pe](https://webchatter.000.pe)

I have set the headers for Access-Control- Allow-Origin, Access-Control- Allow-Headers, Access-Control- Allow-Methods, but i’m still getting CORS error

“Access to XMLHttpRequest at ‘[https://errors.infinityfree.net/errors/403/](https://errors.infinityfree.net/errors/403/)’ (redirected from ‘my website’s ajax-chatdisp.php file’) from origin ‘my website’ has been blocked by CORS policy: Request header field x-requested-with is not allowed by Access-Control-Allow-Headers in preflight response. jquery.js:2 GET infinityfree error page::ERR\_FAILED”"

ajax-chatdisp.php file is

\<?php header("Access-Control-Allow-Origin: https://webchatter.000.pe"); header('Access-Control-Allow-Methods: GET, DELETE, HEAD, OPTIONS,POST'); header("Access-Control-Allow-Headers: X-Requested-With"); $conn=mysqli\_connect("sql104.infinityfree.com","if0\_36289146","rjcoWTSUnr1G3","if0\_36289146\_Webchatter") or die("connection failled"); $sender\_id=$\_POST['admin\_id']; $receiver\_id=$\_POST['userct\_id']; $upsql="SELECT \* from message order by dateT"; $result1=mysqli\_query($conn, $upsql); while($row=mysqli\_fetch\_assoc($result1)){ //send messages if($row['sender\_id']===$sender\_id && $row['receiver\_id']===$receiver\_id ) { if ($row['files']==="") {.... In Ajax request i'm using method type POST same error i'm getting for my one other (ajax-chatbar.php) file too, there also i have included these headers but nothing is working. Please help because on 22 of april i have to submit this project

---

<div class="post-metadata">

**Author:** ![Meishin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/meishin/32/59902_2.png) [@Meishin](https://forum.infinityfree.com/u/Meishin)\
**Post date:** [April 16, 2024, 8:17am UTC](https://forum.infinityfree.com/t/cors-issue/92388/2 "2024-04-16T08:17:10Z")

</div>

> [@anon18889275](#):
>
> ajax-chatdisp.php

The word chat is not allowed in our hosting.

> [@Redirected to InfinityFree 403 Forbidden page](https://forum.infinityfree.com/t/redirected-to-infinityfree-403-forbidden-page/58664):
>
> Getting a 403 error means the server is refusing to show your webpage. Here are the most common causes and how to fix them: 1. Website Files Are in the Wrong Location The Issue: Your domain might be pointing to an empty or non-existent folder. How to Check: Log into your [InfinityFree client area](https://dash.infinityfree.com) Go to Accounts → [Select your account] → Domains → [Find your domain] → Manage Find the Directory Status card, and look at the Directory displayed there Understanding the folder structure: Your fi…

You can circumvent this by renaming that file to not contain the word chat — but this doesn’t mean that it’s OK to host chat scripts here.

As why your CORS headers settings don’t take effect, I don’t know exactly. What I know is that our 403 don’t allowed to be requested from another source, and apparently you cannot set security headers on our pages.

---

<div class="post-metadata">

**Author:** ![Oxy](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/oxy/32/37989_2.png) [@Oxy](https://forum.infinityfree.com/u/Oxy)\
**Post date:** [April 16, 2024, 8:25am UTC](https://forum.infinityfree.com/t/cors-issue/92388/3 "2024-04-16T08:25:21Z")

</div>

Unlisted on April 16, 2024, 8:25am UTC



---

<div class="post-metadata">

**Author:** ![Oxy](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/oxy/32/37989_2.png) [@Oxy](https://forum.infinityfree.com/u/Oxy)\
**Post date:** [April 16, 2024, 8:25am UTC](https://forum.infinityfree.com/t/cors-issue/92388/4 "2024-04-16T08:25:31Z")

</div>

@anon18889275 you posted your password publicly !

---

<div class="post-metadata">

**Author:** ![anon18889275](https://forum.infinityfree.com/letter_avatar/anon18889275/32/6_449c533f586939b6e5f246632a46421f.png) [@anon18889275](https://forum.infinityfree.com/u/anon18889275)\
**Post date:** [April 16, 2024, 8:47am UTC](https://forum.infinityfree.com/t/cors-issue/92388/6 "2024-04-16T08:47:19Z")

</div>

Hmm I didn’t noticed that while posting but I will change it, thanks for notifying me

---

<div class="post-metadata">

**Author:** ![anon18889275](https://forum.infinityfree.com/letter_avatar/anon18889275/32/6_449c533f586939b6e5f246632a46421f.png) [@anon18889275](https://forum.infinityfree.com/u/anon18889275)\
**Post date:** [April 16, 2024, 9:00am UTC](https://forum.infinityfree.com/t/cors-issue/92388/7 "2024-04-16T09:00:43Z")

</div>

thanks it worked but I will keep in what you have said. This’s a live chat web application, something like whatapp and it’s just a collage project not a real project.

---

<div class="post-metadata">

**Author:** ![Meishin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/meishin/32/59902_2.png) [@Meishin](https://forum.infinityfree.com/u/Meishin)\
**Post date:** [April 16, 2024, 9:06am UTC](https://forum.infinityfree.com/t/cors-issue/92388/8 "2024-04-16T09:06:20Z")

</div>

> [@anon18889275](#):
>
> This’s a live chat web application, something like whatapp and it’s just a collage project not a real project.

A rule is a rule. No matter what kind of excuse you use to wrap up your use case, it’s not going to justify it if it’s a live chat. This is because live chat hogs resources, and you probably would run into the hit limit before any real staff shut it down.

> [@What does the hits limit mean](https://forum.infinityfree.com/t/what-does-the-hits-limit-mean/49330):
>
> One of the limits InfinityFree enforces is the “hits” limit. This article explains what a hit is, how you can control your hits usage and what happens if you exceed the limit. What is a hit? A hit is a simply request to a file on your website, which can be a HTML or PHP page, an image, a CSS file or something else. A hit is not the same as a page view, visit or visitor. Visitor can visit your website multiple times, a visit can include multiple page views, and a single page view can include mu…

That is to say, by dropping the word “live” and turn it into a forum is 100% accepted and allowed. Is your site actually live?

---

<div class="post-metadata">

**Author:** ![anon18889275](https://forum.infinityfree.com/letter_avatar/anon18889275/32/6_449c533f586939b6e5f246632a46421f.png) [@anon18889275](https://forum.infinityfree.com/u/anon18889275)\
**Post date:** [April 16, 2024, 9:11am UTC](https://forum.infinityfree.com/t/cors-issue/92388/9 "2024-04-16T09:11:50Z")

</div>

yes it is live but still there are some bugs and some features are still remaining to be added. It is not fully developed yet, I’m currently working on it.

---

<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:** [April 16, 2024, 12:13pm UTC](https://forum.infinityfree.com/t/cors-issue/92388/10 "2024-04-16T12:13:48Z")

</div>

I have reset your hosting account password, because you shared your password here. Feel free to change it from the client area, just make sure to no reuse the previous password as it’s now compromised.

You will probably need to update your website’s code/configuration to use the new password.

Please remember that:

- This is a publicly accessible forum. Anything you write here can be seen by anyone. So make sure to not publish any sensitive information here.
- Do not share your hosting account password with anyone. It provides full access to your hosting account, letting them edit anything on your website.

> [@anon18889275](#):
>
> This’s a live chat web application, something like whatapp and it’s just a collage project not a real project.

Chat scripts are not allowed on our hosting. There is no exception for educational use, testing or any other non-production usage.

---

<div class="post-metadata">

**Author:** ![anon18889275](https://forum.infinityfree.com/letter_avatar/anon18889275/32/6_449c533f586939b6e5f246632a46421f.png) [@anon18889275](https://forum.infinityfree.com/u/anon18889275)\
**Post date:** [April 16, 2024, 1:04pm UTC](https://forum.infinityfree.com/t/cors-issue/92388/11 "2024-04-16T13:04:08Z")

</div>

Ok, thanks

---

<div class="post-metadata">

**Author:** ![anon18889275](https://forum.infinityfree.com/letter_avatar/anon18889275/32/6_449c533f586939b6e5f246632a46421f.png) [@anon18889275](https://forum.infinityfree.com/u/anon18889275)\
**Post date:** [April 16, 2024, 1:05pm UTC](https://forum.infinityfree.com/t/cors-issue/92388/12 "2024-04-16T13:05:18Z")

</div>

After representing this project in my college on 22 i will remove it after some day.

---

<div class="post-metadata">

**Author:** ![ChrisPAR](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/chrispar/32/8743_2.png) [@ChrisPAR](https://forum.infinityfree.com/u/ChrisPAR)\
**Post date:** [April 16, 2024, 6:31pm UTC](https://forum.infinityfree.com/t/cors-issue/92388/13 "2024-04-16T18:31:59Z")

</div>

As you have been informed:

> [@Admin](#):
>
> There is no exception for educational use, testing or any other non-production usage.

Ignore this at your own risk, as hosting a chat script here for _any_ purpose **will** result in a suspension.

---

<div class="post-metadata">

**Author:** ![Oxy](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/oxy/32/37989_2.png) [@Oxy](https://forum.infinityfree.com/u/Oxy)\
**Post date:** [April 17, 2024, 7:26am UTC](https://forum.infinityfree.com/t/cors-issue/92388/14 "2024-04-17T07:26:04Z")

</div>

Listed on April 17, 2024, 7:26am UTC



---

<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 24, 2024, 7:26am UTC](https://forum.infinityfree.com/t/cors-issue/92388/15 "2024-04-24T07:26:20Z")

</div>

Closed on April 24, 2024, 7:26am UTC

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