guzzle exception with .localhost domains

元气小坏坏 提交于 2019-12-24 10:11:03

问题


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

I make changes in /etc/apache2/extra/httpd-vhosts.conf but unfortunatley I get error:

cURL error 6: Could not resolve host: userbox.localhost (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

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:

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...)

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.

Question: Do you have any idea how why .localhost subdomains not work with guzzle-curl and what to do to make it works?


回答1:


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.



来源:https://stackoverflow.com/questions/48442382/guzzle-exception-with-localhost-domains

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!