Problem related to CORS

Asked

Viewed 2,764 times

2

In recent days I had a problem with the contact form of my site, the error in question is CORS. Well, so far so good, it’s a problem that I’m sure a lot of you have already passed. The problem in question is that, until long ago, it was working perfectly, and I made no changes either on the client side (JAVASCRIPT) or on the server side. Suddenly, he went and began to make this next mistake:

Failed to load SERVER SIDE: Redirect from 'SERVER SIDE' to 'SERVER SIDE' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested Resource. Origin 'CLIENT SIDE' is therefore not allowed access.`

And the worst is that I have already set up the header in PHP in several ways and nothing, look how it is currently:

header("Access-Control-Allow-Headers","*");
header('Access-Control-Allow-Credentials', true);
header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');

Does anyone there have any idea what it can be and how I can solve this situation?

Note: I have also tried to touch .htacess and also solved nothing.

  • What kind of request is on this form?

  • So Dvdsamm, he makes a GET request. If you want to see my website it’s this one (http://www.adaideias.ga/contact)

  • I tried to fill it out there but it won’t get past the zip code!

  • Already tried header('Access-Control-Allow-Origin', '*') ?

  • I got it. I managed to fill out the whole form. The error appears when sending.

  • I don’t know if it has anything to do with it, but your mistake is: Redirect from 'http://adaideias.ga/contato.php to 'http://www.adaideias.ga/contato.php. Does the lack of "www" in the first URL is making the server understand that it is another domain?

  • Actually Dvdsamm your message arrived here, I only answered at the time because I was working. But anyway, does it have anything to do with the new browsers? In the case that browser you use? Here was the error, on the Windows 10 x64 computer with Google Chrome 61.0.3163.100, and on another Windows 7 x86 computer with Firefox, I do not remember what version it was, because I already returned this computer to the client, but it was the newest version of the Mozilla browser.

  • Does the lack of "www" in the first URL is making the server understand that it is another domain? So I don’t know for sure, but I don’t think so, because look, until then it was working perfectly, and out of nowhere it was this error, and as I said before, I didn’t change anything in the Javascript code and nothing in the PHP code, I mean there’s some weird stuff there, if I had moved one of the two, that’s fine, but I didn’t move it, and it was working perfectly, so either the problem is the server, which I think is rare, or it’s in the newer browsers, because it’s not making sense.

Show 3 more comments

1 answer

0


"WWW" was missing. The reason I can’t say for sure because it was working well before without the WWW, could be something related to the same server. But that’s problem solved.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.