Xmlhttprequest access blocked by CORS policy

Asked

Viewed 157 times

0

I’m doing a post this way;

$.post("_checa.php",
{
    inst: 'val'
}, function(data)
{
    console.log(data);
});

It is working normal if use on http, but when switching to https, I have the return:

Access to XMLHttpRequest at 'https://www.meusite.com.br/_checa.php' from origin 'https://meusite.com.br' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

In the archive _checa.php left blank to test, and is returning status 301

  • 1

    Look at the www, is in a different subdomain. I’m not sure, but I think different subdomains, even being in the same domain, give Cors error

  • Yeah, thanks bro. Dude <base href="https://www.meusite.com.br/"> was with www, so I just removed it

No answers

Browser other questions tagged

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