guzzle exception with .localhost domains
Asked Answered
P

1

1

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?

Precession answered 25/1, 2018 at 12:1 Comment(2)
Did you ever find a solution/workaround for this?Succinylsulfathiazole
@Succinylsulfathiazole - I write answer however Im not satisfy...Wivinia
P
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.

Precession answered 12/6, 2018 at 9:49 Comment(1)
Thanks Kamil, It's not really possible with the dev setup for this project. It is a strange quirk!Succinylsulfathiazole

© 2022 - 2024 — McMap. All rights reserved.