使用.localhost域进行guzzle异常

问题描述 投票:1回答:1

在我的本地机器上,我有两个服务(在laravel 5中):userBox和mailBox。 mailBox在登录期间使用库"guzzlehttp/guzzle": "~6.0"和restful API(mailBox发送用户凭证和获取信息,用户存在且具有适当的访问权限)使用userBox。在.dev subdomains stopps working之后我决定使用.localhost子域,所以我有:

userbox.localhost
mailbox.localhost

我在/etc/apache2/extra/httpd-vhosts.conf做了更改,但不幸的是我收到错误:

cURL错误6:无法解析主机:userbox.localhost(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html

所以我在互联网上找到解决方案:我们只需要向/etc/hosts添加新的子域名。之后,旧的错误得到解决,但出现了新错误:

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 Not Found Not Not Found(截断...)

我不知道如何解决它(链接GET qazxsw poi ...从上面的异常工作在浏览器中) - 当我将qazxsw poi更改为qazxsw poi时,然后一切正常。

问题:您是否知道为什么http://userbox子域不能与userbox.localhost一起使用以及如何使其工作?

php laravel localhost guzzle php-curl
1个回答
1
投票

目前我发现只有一个“琐碎”(解决方法)解决方案来解决这个问题 - 将用户盒域从userbox.ddd更改为.localhost。但是我仍然不知道为什么guzzle不支持.localhost地址。

© www.soinside.com 2019 - 2024. All rights reserved.