muathye's avatar
Level 41

[Issue with Laravel 10, Nova 4, and AWS (Inertia.js Error)] All Inertia requests must receive a valid Inertia response, however, a plain JSON response was received.

Here’s a clearer version of your question:


Issue with Laravel 10, Nova 4, and AWS (Inertia.js Error)

I'm experiencing an issue with Laravel 10 and Nova 4 on AWS that does not occur on my localhost or VPS.

Issue:

When navigating the webpage on AWS, I get the following error:

"All Inertia requests must receive a valid Inertia response, however, a plain JSON response was received."

Observations:

  • Laravel 9 and Nova 3 work fine on AWS.
  • On AWS, the X-Inertia: true header is missing from the response headers.
  • However, on localhost and VPS, the X-Inertia: true header is correctly included.

Screenshot of the issue:

Issue Screenshot

2 likes
2 replies
Sinnbeck's avatar

Try adding x-inertia to the exposed_headers in cors.php

'exposed_headers' => ['x-inertia']

You might need to publish it with php artisan config:publish cors

muathye's avatar
Level 41

@Sinnbeck Thank you for your reply. I tried adding X-Inertia to exposed_headers in CORS, but the issue still persists.

Here’s a screenshot of the error:
Issue Screenshot

I also previously tried setting:

'exposed_headers' => ['*']

but it didn't resolve the issue.

Since this only happens on AWS (and not on localhost or my VPS), is there anything specific I need to configure on AWS to fix this?

Please or to participate in this conversation.