提供的主机名错误

Bad hostname provided

护照版本:^10.1

Laravel版本:8.77.1

PHP版本:8.0.9

数据库驱动程序和版本:mysql8.0.27

我无法获取访问令牌。 当我通过 curl 手动调用它时,它得到了这个响应。

此主机名在 docker 容器内生成

我正在测试 docker 容器的 192.168.224.6 ip,但它也不起作用


/var/www/html # curl --location --request POST 'http://docker-nginx/oauth/token' \
> --header 'Accept: application/json' \
> --form 'grant_type="password"' \
> --form 'client_id="4"' \
> --form 'client_secret="hZJ33buLLIe3ekqe1dv62tn6RkBFMp59fZjeBgPW"' \
> --form 'username="creatrre@gmail.org"' \
> --form 'password="creatrre@gmail.com"' \
> --form 'scope=""'
{
    "message": "Bad hostname provided.",
    "exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",
    "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
    "line": 391,
    "trace": [
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
            "line": 332,
            "function": "prepareException",
            "class": "Illuminate\Foundation\Exceptions\Handler",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/app/Exceptions/Handler.php",
            "line": 97,
            "function": "render",
            "class": "Illuminate\Foundation\Exceptions\Handler",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
            "line": 51,
            "function": "render",
            "class": "App\Exceptions\Handler",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 172,
            "function": "handleException",
            "class": "Illuminate\Routing\Pipeline",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/fideloper/proxy/src/TrustProxies.php",
            "line": 57,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Fideloper\Proxy\TrustProxies",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustHosts.php",
            "line": 48,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 167,
            "function": "handle",
            "class": "Illuminate\Http\Middleware\TrustHosts",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 103,
            "function": "Illuminate\Pipeline\{closure}",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 142,
            "function": "then",
            "class": "Illuminate\Pipeline\Pipeline",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 111,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        },
        {
            "file": "/var/www/html/releases/20211223205412/public/index.php",
            "line": 52,
            "function": "handle",
            "class": "Illuminate\Foundation\Http\Kernel",
            "type": "->"
        }
    ]
/var/www/html #


如果你的护照不使用任何前缀,最好使用

APPURL改为docker容器名http://docker-nginx

http:///docker-nginx/oauth/token错了

env('APP_URL')/oauth/token 正确