I came across a similar question and found a solution.
If I call my Laravel 8 API and look for the headers, these may come useful:
host: ["127.0.0.1:8000"]
origin: ["http://localhost:3000"]
referer: ["http://localhost:3000/"]
So then I know that host is where API is hosted, origin and referer, they have some difference tho.
Your problem may be caused because you try to access them from middleware, try to check them directly from a controller.
Also if you need sender hostname in a clear look, you can use this code:
public function SomeController(Request $request)
{
$host = explode('/', $request->header('origin'))[2]
// Or with the referer
$host = explode('/', $request->header('referer'))[2]
If you still get null in the response, you can simply debug it, just check for all headers:
$headers = $request->header()