I have an app with wildcard subdomain routes. I also have A Records for * pointed at the correct IP.
The problem is that when use a subdomain I don't get the route wildcard, but end up on the naked domain root.
web.php
Route::domain('{item}.example.test')->group(function() {
Route::group(['namespace' => 'Example'], function() {
Route::get('/', 'ExampleController@show')->name('example.show'); // This is where i want to go
});
});
Route::get('/', function() {
return view('welcome'); // This is where I end up
});
Obviously the production domain is not "example.test", so I created an environment variable called APP_DOMAIN and set it to example.test on dev and to the production domain on the server. Then changed web.php thusly: