Erro Access-Control-Allow-Origin

PEssoal como faço resolver esse erro na configuração do Vhost do CloudPanel?

Access to XMLHttpRequest at ‘https://tatoscredito.com.br/wp-admin/admin-ajax.php’ from origin ‘https://sm.tatoscredito.com.br’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Access to XMLHttpRequest at ‘https://tatoscredito.com.br/wp-admin/admin-ajax.php’ from origin ‘https://sm.tatoscredito.com.br’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.Understand this errorAI
hook.js:1

   POST https://tatoscredito.com.br/wp-admin/admin-ajax.php net::ERR_FAILED 406 (Not Acceptable)

(anonymous) @ hook.js:1
send @ jquery.min.js?ver=3.7.1:1
ajax @ jquery.min.js?ver=3.7.1:1
(anonymous) @ jquery-migrate.min.js?ver=3.4.1:1
(anonymous) @ jquery-migrate.min.js?ver=3.4.1:1
getSellerID @ cgv/:331
(anonymous) @ cgv/:504
dispatch @ jquery.min.js?ver=3.7.1:1
ce.event.add.v.handle @ jquery.min.js?ver=3.7.1:1Understand this errorAI
cgv/:1 Access to XMLHttpRequest at ‘https://tatoscredito.com.br/wp-admin/admin-ajax.php’ from origin ‘https://sm.tatoscredito.com.br’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.Understand this errorAI
hook.js:1

   POST https://tatoscredito.com.br/wp-admin/admin-ajax.php net::ERR_FAILED 406 (Not Acceptable)

Tenta a configuração desta aula.

Nao funcionou, tinha usado esse script.

Mas consegui resolver com o mesmo principio:

Coloquei o script abaixo dentro da condição:

location ~ .php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
add_header Access-Control-Allow-Origin “*”;
try_files $uri =404;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_param HTTPS “on”;
fastcgi_param SERVER_PORT 443;
fastcgi_pass 127.0.0.1:{{php_fpm_port}};
fastcgi_param PHP_VALUE “{{php_settings}}”;
}

1 curtida

Perfeito, obrigado pelo retorno.
Apenas precisa ficar atento a atualizações.
Atualizações do CloudPanel podem reescrever personalizações.