I send a POST request from a headless frontend to a craft controller action but the request is not going trough because of:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localcraft.ddev.site/add-comment. (Reason: CORS request did not succeed). Status code: (null).
(I set a custom route in routes.php, so I can reach the action via /add-comment
).
I think I have to do something with $response = Craft::$app->getResponse();
But I can't figure out what.
I also set this at the beginning of my controller:
class AddToQueueController extends Controller
{
protected array|bool|int $allowAnonymous = ["add-comment"];
public $enableCsrfValidation = !["add-comment"];
But that does not help either...
I am glad for any help! Cheers