.localhost 域的 guzzle 异常
guzzle exception with .localhost domains
在我的本地机器上,我有两个服务(在 laravel 5 中):userBox 和 mailBox。邮箱在使用库 "guzzlehttp/guzzle": "~6.0"
和 restful API 登录期间使用 userBox(邮箱发送用户凭据并获取用户是否存在并具有适当访问权限的信息)。在 .dev subdomains stopps working I decide to use .localhost 子域之后,我有:
userbox.localhost
mailbox.localhost
我在 /etc/apache2/extra/httpd-vhosts.conf
中进行了更改,但不幸的是我收到错误消息:
cURL error 6: Could not resolve host: userbox.localhost (see
http://curl.haxx.se/libcurl/c/libcurl-errors.html)
所以我在互联网上查找并找到了解决方案:我们只需要向 /etc/hosts
添加新的子域。旧错误解决后出现新错误:
ClientException in RequestException.php line 113: Client error: GET
http://userbox.localhost/api/v1/users/auth?username=test_manager%40example.com&password=xxxxxxx&MAILBOX_TOKEN=yyyyyyyyyyyyyyyyyyyyyyyyyyy
resulted in a 404 Not Found
response: 404 Not Found
Not Found (truncated...)
而且我不知道如何解决它(link GET http://userbox... from aboce exception works in browser)- hovewer 当我改变 userbox.localhost
到 userbox.ddd
那么一切正常。
问题:您是否知道为什么 .localhost
子域不能与 guzzle-curl
一起使用以及如何使它工作?
目前我发现只有一个 "trivial"(变通方法)解决这个问题 - 将用户框域从 userbox.localhost
更改为 userbox.local
。但是我仍然不知道为什么 guzzle 不支持 .localhost 地址。
在我的本地机器上,我有两个服务(在 laravel 5 中):userBox 和 mailBox。邮箱在使用库 "guzzlehttp/guzzle": "~6.0"
和 restful API 登录期间使用 userBox(邮箱发送用户凭据并获取用户是否存在并具有适当访问权限的信息)。在 .dev subdomains stopps working I decide to use .localhost 子域之后,我有:
userbox.localhost
mailbox.localhost
我在 /etc/apache2/extra/httpd-vhosts.conf
中进行了更改,但不幸的是我收到错误消息:
cURL error 6: Could not resolve host: userbox.localhost (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
所以我在互联网上查找并找到了解决方案:我们只需要向 /etc/hosts
添加新的子域。旧错误解决后出现新错误:
ClientException in RequestException.php line 113: Client error:
GET http://userbox.localhost/api/v1/users/auth?username=test_manager%40example.com&password=xxxxxxx&MAILBOX_TOKEN=yyyyyyyyyyyyyyyyyyyyyyyyyyy
resulted in a404 Not Found
response: 404 Not Found Not Found (truncated...)
而且我不知道如何解决它(link GET http://userbox... from aboce exception works in browser)- hovewer 当我改变 userbox.localhost
到 userbox.ddd
那么一切正常。
问题:您是否知道为什么 .localhost
子域不能与 guzzle-curl
一起使用以及如何使它工作?
目前我发现只有一个 "trivial"(变通方法)解决这个问题 - 将用户框域从 userbox.localhost
更改为 userbox.local
。但是我仍然不知道为什么 guzzle 不支持 .localhost 地址。