When you run php artisan serve it uses localhost not a custom domain.
Jun 19, 2024
8
Level 2
route() is returning localhost:8000 despite changing configs
edit: For anyone reading this and not going through the whole thread, this issue was showing when using https://expose.dev/ - it does not happen with https://ngrok.com/ Original post below:
I'm getting this on my local dev box when using php artisan serve. I feel like I'm missing something silly. I've tried php artisan route:clear and php artisan cache:clear
I've got the .env
APP_DOMAIN=asdf.sharedwithexpose.com
APP_URL=https://${APP_DOMAIN}
and app.php
'url' => env('APP_URL', 'https://asdf.sharedwithexpose.com'),
'domain' => env('APP_DOMAIN', 'asdf.sharedwithexpose.com'),
When I run php artisan tinker and dump route('login') I get the correct domain, but if I edit a test route in web.php the route()s both show localhost
Route::get('foo', function() {
dump(Route::getCurrentRoute()->middleware()); # only web loaded
dump(env('APP_URL')); # correct output
dump(env('APP_DOMAIN')); # correct output
dump(config('app.url')); # correct output
dump(config('app.domain')); # correct output
dump(route('login', [], true)); # incorrect localhost
dump(route('home')); # incorrect localhost
});
Please or to participate in this conversation.