.localhost域的大量异常 [英] guzzle exception with .localhost domains
问题描述
在我的本地计算机上,我有两项服务(在laravel 5中):userBox和mailBox.邮箱在登录时使用库"guzzlehttp/guzzle": "~6.0"
和Restful API使用userBox(邮箱发送用户凭据并获取信息,前提是用户存在并且具有适当的访问权限).在 .dev子域停止工作后,我决定使用.localhost 子域,所以我拥有:
On my local machine I have two services (in laravel 5): userBox and mailBox. mailBox use userBox during login using library "guzzlehttp/guzzle": "~6.0"
and restful API (mailBox send user credential and get info do user exists and have proper access). After .dev subdomains stopps working I decide to use .localhost subdomain so i have:
userbox.localhost
mailbox.localhost
我在/etc/apache2/extra/httpd-vhosts.conf
中进行了更改,但很不幸,我得到了错误:
I make changes in /etc/apache2/extra/httpd-vhosts.conf
but unfortunatley I get error:
cURL错误6:无法解析主机:userbox.localhost(请参阅 http://curl.haxx.se/libcurl/c/libcurl-errors. html )
cURL error 6: Could not resolve host: userbox.localhost (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
因此,我在Internet上找到了解决方案:我们只需要向/etc/hosts
添加新的子域.解决了旧错误之后,出现了新错误:
So i look on internet and found solution: we just need add new subdomains to /etc/hosts
. After that old error was solved but new one appears:
RequestException.php第113行中的ClientException:客户端错误:
GET http://userbox.localhost/api/v1/users/auth?username=test_manager%40example.com&password=xxxxxxx&MAILBOX_TOKEN=yyyyyyyyyyyyyyyyyyyyyyyyyyy
导致出现404 Not Found
响应:找不到404 找不到(被截断...)
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...)
而且我不知道该如何解决(从aboce异常中获取链接GET http://userbox ...在浏览器中)-当我将userbox.localhost
更改为userbox.ddd
时,一切正常.
And I don't know how to solve it (link GET http://userbox... from aboce exception works in browser) - hovewer when I change userbox.localhost
to userbox.ddd
then everything works fine.
问题:您是否知道为什么.localhost
子域不能与guzzle-curl
一起使用以及如何使它起作用?
Question: Do you have any idea how why .localhost
subdomains not work with guzzle-curl
and what to do to make it works?
推荐答案
当前,我仅找到一种解决此问题的简单"(解决方法)解决方案-将用户箱域从userbox.localhost
更改为userbox.local
.但是,我仍然不知道为什么狂饮不支持.localhost地址.
Currently I found only one "trivial" (workaround) solution to solve this problem - change userbox domain from userbox.localhost
to userbox.local
. However still I don't know why guzzle not support .localhost address.
这篇关于.localhost域的大量异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!