Building42 / Telegraph

Secure Web Server for iOS, tvOS and macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Am new to iOS development, am trying to run http(insecure) server on iOS

trnchawla opened this issue · comments

Hi,

I tried running the example iOS server. Http requests are running fine on same iPad(means I can do HTTP requests on the same iPad where HTTP server is running) but when I try to do HTTP request from another mac/iPhone/iPad on same network, I get an error on the browser. Do I need to have certificate always?

am running the server on iPad with version 13.3.1 and am trying to access it from the browser on my mac mini with Catalina OS.

Hi @trnchawla

Apple is pushing hard for apps to use HTTPS instead of HTTP. But for local networks you can add the NSAllowsLocalNetworking key to your Info.plist. Please note that the clients require this key.

For more info see: Telegraph - Usage and the Apple Docs

The Server in the demo starts in a mode that only allows connections from localhost. If you want the server to allow connections from other devices, be sure to remove the interface argument:

try! server.start(port: 9000, interface: "localhost")
try! server.start(port: 9000)

If you have any issues after this, feel free to reopen the ticket!