Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

BSP's avatar
Level 1

Homestead port forwarding

I'm new to Vagrant and Homestead and I don't know a much about networking so I'm a bit lost on how it all works.

This is my current setup.

I have virtualBox - vagrant - homestead working on windows 8.1

I have a test laravel site I called: thesocket.local

In my windows hosts file I have ** 192.168.10.10 thesocket.local **

On my windows machine, when I go to http://thesocket.local, I get the demo Laravel welcome page, so it works fine so far.

The issue is that I have is with laravel-echo-server which is installed in the vagrant machine, and it has to make a call to my site which is accessible at http://thesocket.local from my windows machine.

laravel-echo-server needs to make a call to http://thesocket.local/broadcasting/auth

and it can't seem to reach that route because thesocket.local doesn't mean anything on the vagrant machine (I don't think). It only means something on my windows system because I specified it in the hosts file.

Anyways, this is what laravel-echo-server (nodejs) is saying in the console when it tries to reach the auth route:

[08:49:24] - Error authenticating SYQx1N0DEbKWzlHlAAAA for private-users.1
{ Error: getaddrinfo EAI_AGAIN thesocket.local:80
    at Object._errnoException (util.js:1022:11)
    at errnoException (dns.js:55:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
  code: 'EAI_AGAIN',
  errno: 'EAI_AGAIN',
  syscall: 'getaddrinfo',
  hostname: 'thesocket.local',
  host: 'thesocket.local',
  port: 80 }
Error sending authentication request.

So my question is, how do I forward the request coming from the nodejs server running on vagrant, to my windows machine, which then knows how to forward it back to vagrant on port 80, so it can reach the desired route on the site?

Or is there a simpler solution?

Thank you!

0 likes
4 replies
BSP's avatar
Level 1

UPDATE: I just realized that http://thesocket.local should be able to be called from inside the vagrant machine because ngnix does have it in sites-enabled.

However, when I tried to test via command line inside vagrant and did wget thesocket.local, it returned

Resolving thesocket.local (thesocket.local)... failed: Temporary failure in name resolution.
lostdreamer_nl's avatar
Level 53

Nginx knows about it, but your network settings do not.

sudo vi /etc/hosts
127.0.0.1 thesocket.local

:wq <ENTER> to save the file

2 likes
BSP's avatar
Level 1

Awesome!!!

[10:55:59] - v17kroaDVGw0sMQ5AAAA authenticated for: private-users.1
[10:55:59] - v17kroaDVGw0sMQ5AAAA joined channel: private-users.1

Thank you!

Please or to participate in this conversation.