I have tried valet link api.domain
but it shows 502 Bad Gateway. My folder structure is basically very simple. I am using valet park on ~/Sites
and there is a backend
and frontend
folder in that ~/Sites
directory. I basically want to access api.domain.test
and spa.domain.test
instead of backend.test
and frontend.test
.
The reason is using Laravel Sanctum with XSRF cookie protection. The domain TLD must be same for the cookies to work. I have also tried valet proxy
but that only worked properly for frontend.test
being mapped to localhost:3000
where I serve my Next.js. Any help would be appreciated. Thanks.
CodePudding user response:
Have you tried the following
cd ~/Sites/backend
valet link api.domain
cd ~/Sites/frontend
valet link spa.domain
valet proxy spa.domain http://127.0.0.1:3000