Nuxt - Laravel Precognition
GitHubNuxt Module
  • Getting Started
    • Introduction
    • Installation
  • Usage
    • Configuration
  • Validation
  • Error handling
  • File uploads
  • Use with Nuxt UI
  • Composables
    • usePrecognitionForm
    • usePrecognitionConfig
    • useNuxtFormValidator
  • Other
    • Breeze Nuxt template
    • Troubleshooting
Powered by GitBook
On this page
  • Expose Precognition headers for CORS
  • Other problems
  1. Other

Troubleshooting

Follow this guide in case you are experiencing unexpected behaviour or facing some errors in the module work.

Expose Precognition headers for CORS

Since Laravel Precognition requires additional headers to be passed to the front-end application, make sure that you have configured exposed_headers in your config/cors.php on the Laravel side:

<?php

declare(strict_types=1);

return [
    'paths' => ['*'],
    'allowed_methods' => ['*'],
    'allowed_origins' => ['http://your-nuxt-app.dev'],
    'allowed_origins_patterns' => [],
    'allowed_headers' => ['*'],
    'exposed_headers' => ['Precognition', 'Precognition-Success'], // required
    'max_age' => 0,
    'supports_credentials' => true,
];

Other problems

PreviousBreeze Nuxt template

Last updated 2 months ago

If you experience any other problem related to the API requests, please refer to the official nuxt-auth-sanctum module documentation - .

If nothing helps, feel free to on the GitHub repository.

Nuxt - Laravel Sanctum
raise an issue