As suggested in the GitHub Discussion, it was a problem with the webserver configuration. I'm using a custom docker image and nginx proxy on local. I was able to fix it by adding the header in nginx.conf:
nginx.conf
add_header X-Inertia "true";