Can you access the Vapor Server from another device when running locally?

I can’t seem to access the server from another device when running locally. It works on localhost but if I try to access from a different device it won’t work. Don’t think it’s my router as it works fine if I run simple python server from the terminal.

I’ve tried this:
Vapor server running on 192.168.1.10 port 8080
using my iPhone or computer in a browser: http://192.168.1.10:8080/hello also tried https

I just get page can’t be reached…hopefully someone can point me in the right direction :slight_smile:

Thanks!

Looks like you have to explicitly open all ports. In configure.swift, this seems to work:

let serverConfig = NIOServerConfig.default(hostname: "0.0.0.0")
services.register(serverConfig)
3 Likes

@hodgins Thank you for sharing your solution - much appreciated! :]