Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bbkbbk's avatar

Can't access POST endpoint in Livewire (Fortify)

I am trying to implement Livewire with Fortify for creating user accounts. I have custom functionality I need in the registration process which is why I chose not to use Jetstream.

I've created a registration page and a form. My initial thoughts was to call a submit function in the registration component that calls the 'register' post endpoint created by Fortify:

<form wire:submit.prevent="submitRegistration">

public function submitRegistration()
{
    $response = Http::post(route('register'), [
        'name' => $this->name,
        'email' => $this->email,
        'password' => $this->password,
        'password_confirmation' => $this->passwordConfirm
    ]);

    Log::info(print_r($response->json(), true));
}

Whenever I try to run this by clicking on the submit form I get the following error:

cURL error 28: Operation timed out

If I run "php artisan route:list" I can see that the POST endpoint exists.

I'm not sure what is causing this error. I've also tried using "url('register')" in the POST call but I get another curl error which is based on a timeout.

Any help is appreciated.

0 likes
2 replies
LaryAI's avatar
Level 58

It looks like the issue is with the HTTP request timing out. One solution could be to increase the timeout for the HTTP request. You can do this by passing in an array of options as the third parameter to the post method, with the timeout option set to a higher value. For example:

$response = Http::post(route('register'), [
    'name' => $this->name,
    'email' => $this->email,
    'password' => $this->password,
    'password_confirmation' => $this->passwordConfirm
], [
    'timeout' => 30 // increase timeout to 30 seconds
]);

This sets the timeout to 30 seconds, which should be enough time for the request to complete. You can adjust the timeout value as needed.

Another solution could be to use Livewire's built-in wire:click directive instead of wire:submit. This will send the form data via an AJAX request, which may be more reliable than using an HTTP request. Here's an example:

<form wire:submit.prevent>
    <!-- form fields here -->
    <button wire:click="submitRegistration">Submit</button>
</form>

// in the Livewire component
public function submitRegistration()
{
    $response = Http::post(route('register'), [
        'name' => $this->name,
        'email' => $this->email,
        'password' => $this->password,
        'password_confirmation' => $this->passwordConfirm
    ]);

    Log::info(print_r($response->json(), true));
}

This uses Livewire's wire:click directive to call the submitRegistration method when the form is submitted. The method then sends the form data via an HTTP request as before.

bbkbbk's avatar

@LaryAI Tried using the wire:click method but still getting the same results

Please or to participate in this conversation.