3
votes

As title says, I can access localhost fine but my app needs a callback from twitter through 127.0.0.1:8000 and 127.0.0.1:8000 is getting "connection refused"

EDIT: This looks to be an IPv6 conflict, I can access my local server through (Apache Port) http://127.0.0.1:8888/

EDITEDIT: It appears if I serve an angular app on port 9000 I can reach it with 127.0.0.1:9000 in my browser fine, however if I run php artisan serve --port=9000 then then I still get a connection refused error.

So my issue has been refined to: How can I get php artisan serve (for laravel app) to work with http://127.0.0.1:8000/

Lewiss-MBP:stripe2 Lewis$ php artisan serve Laravel development server started on http://localhost:8000/

The meat:

OSX YOSOMITE 10.10.5

MAMP (non pro) is set to Apache not NGINX

etc/hosts : file -b /etc/hosts === ASCII English text

127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost

Lewiss-MBP:applications Lewis$ telnet -6 ::1 8000 </dev/null Trying ::1... Connected to localhost. Escape character is '^]'. Connection closed by foreign host.

Lewiss-MBP:applications Lewis$ telnet -4 127.0.0.1 8000 </dev/null Trying 127.0.0.1... telnet: connect to address 127.0.0.1: Connection refused telnet: Unable to connect to remote host

1
You cannot ping a url or a port. You can only ping a system by its IP or domain name, and that request often is blocked by firewalls. Actually ping is not a very good utility to find network issues. Its original purpose is to take a look at network latency. Not more, not less. Take a look instead at utilities like telnet, host, dig, traceroute. - arkascha
It might be serving over IPv6 only. Try telnet -6 ::1 8000 </dev/null and telnet -4 127.0.0.1 8000 </dev/null, and see which ones give "Connected to ..." and which give "Connection refused". - Gordon Davisson
Thanks guys, both great feedback, I've tried Gordon's commands and updated my question. I'll google about IPv6 etc to see if I can resolve this, but if anyone can give me the commands then I'd be very grateful. - Lewis
If you have solved your problem, please post the solution as an answer and mark it as accepted. Don't put that into the question itself. - deceze♦

1 Answers

2
votes

l;dr; SOLVED : after a LOT of trawling, if I run php artisan serve --host 0.0.0.0 my app works fine, as does twitter app callbacks to 127.0.0.1

The issue must be in how Artisan listens..