Calling an API on my local machine from within a container only works at first load

Hey guys πŸ‘‹ I'm running a Nuxt app inside a Docker container that talks to my local machine Laravel API on
localhost:8000
.

I've added these lines in my
docker-compose
file to make the container see my localhost.
extra_hosts:
  - 'host.docker.internal:host-gateway'

.env

NUXT_PUBLIC_BASE_URL="http://host.docker.internal:8000"

Although The initial page load works, the subsequent link clicks fail with a 404 error as the browser send the requests to
http://host.docker.internal:8000/api/some-api-endpoint
and don't find it.

I guess I need some sort of two-way mapping but I don't have a clue where to start looking.
Was this page helpful?