在iPhone上连接到localhost无法正常工作

时间:2019-06-01 01:05:42

标签: iphone networking localhost

我正在尝试在移动设备上测试我的React网站。正在端口8080上提供服务。

过去我会这样做:

  1. 转到Network并复制我的IP(192.168.1.109
  2. 在我的iPhone上打开Safari,然后输入http://192.168.1.109:8080

但是,它不起作用。我什至尝试去System Preferences > Sharing > Internet Sharing,打开Internet共享并访问http://Edmunds-MacBook-Pro.local:8080,但仍然无法正常工作

我检查了,防火墙关闭了。我还尝试了从这两个设备断开连接并重新连接。

我确认服务器正在运行并且在笔记本电脑上打开http://localhost:8080可以正常工作。我还确认我已连接到同一Wifi网络

我想念什么?

这是我输入ifconfig时返回的内容:

 ✗ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
        inet 127.0.0.1 netmask 0xff000000
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
        nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
XHC20: flags=0<> mtu 0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        ether c4:b3:01:ca:16:05
        inet6 fe80::10e9:9bf6:1f27:2d28%en0 prefixlen 64 secured scopeid 0x5
        inet 192.168.1.109 netmask 0xffffff00 broadcast 192.168.1.255
        inet6 2604:2000:14c3:4246:cca:5997:9197:e83b prefixlen 64 autoconf secured
        inet6 2604:2000:14c3:4246:842b:df7d:9055:4d75 prefixlen 64 autoconf temporary
        nd6 options=201<PERFORMNUD,DAD>
        media: autoselect
        status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
        ether 06:b3:01:ca:16:05
        media: autoselect
        status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
        ether 0a:d0:b8:c7:6e:63
        inet6 fe80::8d0:b8ff:fec7:6e63%awdl0 prefixlen 64 scopeid 0x7
        nd6 options=201<PERFORMNUD,DAD>
        media: autoselect
        status: active
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        options=60<TSO4,TSO6>
        ether 6a:00:02:a3:a4:80
        media: autoselect <full-duplex>
        status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        options=60<TSO4,TSO6>
        ether 6a:00:02:a3:a4:81
        media: autoselect <full-duplex>
        status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=63<RXCSUM,TXCSUM,TSO4,TSO6>
        ether 6a:00:02:a3:a4:80
        inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
        inet6 fe80::6800:2ff:fea3:a480%bridge0 prefixlen 64 scopeid 0xa
        Configuration:
                id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
                maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
                root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
                ipfilter disabled flags 0x2
        member: en1 flags=3<LEARNING,DISCOVER>
                ifmaxaddr 0 port 8 priority 0 path cost 0
        member: en2 flags=3<LEARNING,DISCOVER>
                ifmaxaddr 0 port 9 priority 0 path cost 0
        nd6 options=201<PERFORMNUD,DAD>
        media: <unknown type>
        status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
        inet6 fe80::c359:c276:911a:a688%utun0 prefixlen 64 scopeid 0xb
        nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
        inet6 fe80::221b:cafd:8b5:decb%utun1 prefixlen 64 scopeid 0xe
        nd6 options=201<PERFORMNUD,DAD>

0 个答案:

没有答案