"No route to host" when trying to make WebSocket connection to a locally-hosted server without Internet access

Originator:michael
Number:rdar://45198262 Date Originated:10/11/2018
Status:OPEN Resolved:
Product:iOS SDK + Safari Product Version:12.0
Classification:Serious Bug Reproducible:Always
 
Summary:

I'm working on a hardware device that broadcasts its own wireless access point (with no access to the open Internet) and hosts its own HTTP and WebSocket servers for users to connect to via MobileSafari. 

In iOS 11 and earlier (and Android devices), I am able to successfully connect to both the HTTP server and the WS server locally. In iOS 12, I am no longer able to connect to the web socket server.

Steps to Reproduce:

Run a local wireless network without access to the open Internet. It cannot be a network created using macOS's "Create Network" feature. (In my case, it's an Android device using Android's provided Access Point APIs).

Have one device host an HTTP server that serves up a web page / JS bundle that instructs the browser to connect via WebSockets to a WS server hosted on that same server (I have tested both with the WS and HTTP servers on the same port and on different ports).

A sample project exists at https://github.com/lazerwalker/ios-12-websocket-bug. It has a node.js server with an HTTP endpoint that returns some JS that connects to a WS server it also provides.

For that sample project:

1. Connect to the network via a desktop computer with the sample project. Run `npm install`, then `node server.js`.

2. On an iOS 12 device, connect to the network and go to `http://SERVER-IP:3000`.

Expected Results:

The HTTP request is completed successfully, and the browser client is able to establish a connection with the WebSocket server.

For the sample project: the console log for the iOS 12 device will contain some benign log messages, but no errors. The console for the server process will show the text "Hi server!"

Actual Results:

On iOS 12, the HTTP request is successful, and loads the website, but the WS connection fails with the error “No route to host” (visible via a remote web inspector window).

The given sample project works for me on iOS 12 if I navigate to the server via hostname rather than IP address (e.g. my Mac's hostname is "ono-sendai". `http://ono-sendai.local:3000` works, whereas `http://192.168.43.177:3000` fails as described above.

This sample project works perfectly for me on (a) iOS devices running iOS 11 or earlier, (b) every Android device I have tested, and (c) laptops running macOS.

Additionally, this works as expected when the wireless network is being provided by the Mac that is running the sample project server, via the "Create Network" option in the menu. This means that to test/reproduce, you'll need an external network.

Version/Build:

iPhone XS Max running iOS 12.0 (16A366)
Server: MacBook Pro 2018 running macOS 10.14 (18A391). 
I am running the sample node project via node.js v8.11.3, but the issue was initially discovered via a Java HTTP and WS server running on the Android tablet also providing my access point.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!