php - How does laravel know the value of request()->getHttpHost()

one text

Solution:

Laravel will first look at the X_FORWARDED_HOST HTTP header. If this header is not available, it will look at the HOST HTTP header.

If neither of those headers are available (i.e. when using the command-line) it will look at the SERVER_NAME configuration variable. Finally, if the server name is also not available it will return the value of the SERVER_ADDR configuration variable.

You can read the source of Request::getHttpHost here.

Source