Creating child page from POST request

I am trying to use a controller in Kirby 3 to create a child after a POST request.

My controller looks like this:

return function($site, $pages, $page) {
  $error = null;
  if(r::method() === 'POST') {
    $data = array(
      'firstname' => get('firstname'),
      'lastname' => get('lastname'),
      'email' => get('email'),
    try {
        'slug'     => uniqid(),
        'template' => 'submission'
    } catch(Exception $e) {
      echo json_encode(array('errorMsg' => $e->getMessage()), JSON_HEX_QUOT | JSON_HEX_TAG);
  return compact('error');

obviously the page will have content from the form later on, but I always get the error

"Du kannst die Seite \u0022-\u0022 nicht anlegen"

These methods (creating, deleting, updating etc.) need permissions, so you have to be either logged in to create the page, or you have to impersonate a user or authenticate as almighty:


Thanks a lot!
This seems to work. Unfortunately, I am getting a CORB error though

Cross-Origin Read Blocking (CORB) blocked cross-origin 
response with MIME type text/html. 
for more details.

I’m using VUE for the frontend and Kirby as a headless CMS… The backend is on a subdomain.

I’ve already tried setting headers in my template

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");

Somehow, the page is created though. But I need a success response on my frontend.

Any ideas what I am doing wrong?