Website Suddenly not working anymore after server shutdown

Reason: CORS header ‘Access-Control-Allow-Origin’ missing

Username (e.g. epiz_31921642)

epiz_31921642

Error Message

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.worldinformation.rf.gd/getNews.php. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Uncaught (in promise)
Object { message: “Network Error”, name: “AxiosError”, code: “ERR_NETWORK”, config: {…}, request: XMLHttpRequest, response: XMLHttpRequest, stack: “” }
code: “ERR_NETWORK”
config: Object { timeout: 0, xsrfCookieName: “XSRF-TOKEN”, xsrfHeaderName: “X-XSRF-TOKEN”, … }
message: “Network Error”
name: “AxiosError”
request: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
response: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }
stack: "
: Object { constructor: a(e, t, n, r, a), toJSON: toJSON(), stack: “”, … }

Other Information

Before the server shutdown that happened a few days ago My website was working fine. Now it doesn’t work on firefox nor safari only in chrome. What could be the problem? I did no change, it just broke.

What issue?


Looks ok to me

4 Likes

Click on the “Russia News” It doesn’t work. On the top nav bar.

The query to the MySQL database doesn’t work anymore. Although If I type directly on the navigation bar it does work “https://worldinformation.rf.gd/getNews.php” I have the same problem with my other website hosted in Infinity. I can’t communicate with the server using Axios anymore.

So this is what it is supposed to show?

2 Likes

I see this

3 Likes

It works for you then. What browser are you using? What could be wrong with my safari and firefox? Thank you so much.

cannot grasp the information here (CORS)

and then everything is empty if you directly ask for this address
https://worldinformation.rf.gd/getNews.php
because there is nothing in the JSON

www vs naked REQ

2 Likes

Hi, In chrome it works for me but I get this error:

Manifest: Line: 1, column: 1, Syntax error.

You need to give a parameter to the getNews.php file request to work:
You need to give: formData.append(“topic_searched”,“food”).
Now When I print the response I get:

getNews.php This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support

The response you’re getting in your production deployment is the default index.html served when there’s a problem with your node server configuration. It is not about the response being text/html, its about the node server being setup incorrectly (possibly none of the routes are working). The underlying problem could be anything, a few examples in this question.

How can I fix it? And why it broke suddenly? I’m using

npx create-react-app my-app

To create the app, and then I use
npm run build . I don’t know enough to change the default configurations. From What I understand I need to fix some routes. But that is currently beyond what I know.

Chrome

You need to enabled javascript on your browser. What is your cellphone type?

I should be getting back a JSON not HTML, there is a problem with the routes the script is looking to execute the backend code. But that is currently beyond my knowledge. It works for me on Chrome (desktop), but it doesn’t work on safari (tablet) nor firefox (desktop), If you execute: https://worldinformation.rf.gd/getNews.php you get the data. But you don’t get the data if you execute the same inside the react production solution. For what i have investigated the solution is on the react configuration. But I don’t know enough to make those changes.

So I deleted all chrome browser cache data, and now I get the cors issue, It worked once under incognito in chrome, then it stoped working. Now I just get Cors. And my other website: mathematica.rf.gd doesn’t work either. It gets cors too. And they were working before. And I haven’t touch Mathematica.rf.gd
user: [email protected] password: aa

Access to XMLHttpRequest at ‘https://www.worldinformation.rf.gd/serverApi/getNews.php’ from origin ‘https://worldinformation.rf.gd’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
xhr.js:220 POST https://www.worldinformation.rf.gd/serverApi/getNews.php net::ERR_FAILED

I keep getting HTML Code instead of JSON

You can’t make a request from the www subdomain to the base domain, and vise versa, on free hosting. Either configure your entire site to use “www”, or configure your entire site to use the base domain. This is also a good idea from an SEO perspective.

4 Likes

Thank you, can you point me to more information about this? I do not have enough knowledge to understand what you say. Where do I configure this?

In your code. I don’t know how your system is setup, so I can’t really help.

I would do a search for every instance of “www.domain.com” and remove the www. part.

2 Likes

Let me see if I get this:

I do the axios request as follows:

axios.post(window.HostUrl+'serverApi/getNews.php', formData,).then(res=>{...})

where:

window.HostUrl = "https://www.worldinformation.rf.gd/"

That is how I set the url, do you mean that I have to change ‘https://www.worldinformation.rf.gd/’ to ‘worldinformation.rf.gd/’ ?? Thank you.

i though may need canvas or iframe layer tricks.
If i, and i can change the source. I will use php readfile(url) on destination host. And execute the post like common. But does in source. Just a tricks.

Its becouse you don’t have public url post policy. May if you have source url so famous and you are the owner like yourcompany.com. you can do it simply as ussually.