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

m7shapan's avatar

laravel Request when validation failed redirect to index

Hello, I'm trying to build api, I'm facing this problem for the first time when the validation failed redirect to index instead of returning the errors

0 likes
2 replies
m7shapan's avatar
m7shapan
OP
Best Answer
Level 1

it appears that I forget to add Accept application/json in the header of the request url

1 like
amcsi's avatar

True, but still, it's very strange that this behavior happens. There should be some kind of error response, not a redirect to the index page.

Please or to participate in this conversation.