Website Suddenly not working anymore after server shutdown

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.

Thank you Edwin, can you explain this further? I’m new to all these concepts.

1 Like

I did this change on the react code and now I get
XHRGEThttps://errors.infinityfree.net/errors/404/

Can you explain more? I think this is the solution but I can’t fix it. Where do I make those configurations? Thank you!

If you were getting CORS errors using https://www.worldinformation.rf.gd/, then try changing it to https://worldinformation.rf.gd/(without the www).

Most Iframe tricks don’t work here because of the security system. Canvas tricks wouldn’t help in this situation.

What did you change? The URL?

5 Likes

:face_with_spiral_eyes: i’m rethinking. Uhm, maybe this is out my mind. Or maybe you just do a little mistake.

  1. Why you get xhr ajax-cors policy on your same access host.
  2. why you keep receive html not json. Whats kind of html you receive. Can you share the html you receive. :face_exhaling:

so You did this change. If you do xhr ajax on same host you don’t need to write the whole address.

However – try to use http instead of https. just try once maybe Ouups!something goes wrong.

:smiley: delete window.HostUrl
So it become:
axios.post('serverApi/getNews.php', formData,).then(res=>{...})

2 Likes

I would do axios.post('/serverApi/getNews.php', ... instead, or you may run into URL completion issues. But indeed, the easiest way is to just not specify the full URL and just let the browser auto-complete it.

5 Likes

This is the html I get. And also the thing is that at one point it was working the way it was set up. Suddenly it stopped working.

data getNews.php <html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("0e8f2426c71d972ccd1d3f50d68b548d");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="https://www.worldinformation.rf.gd/serverApi/getNews.php?i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>
1 Like

Wow! Thank you! This was the solution. I was doubting my existence with this bug. Thank you so much.

2 Likes