NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

localhost works on my MacBook, but other local machines cant see me

Forums > Server-side Swift

http://localhost:8080/home works fine on my laptop, but trying to look at it from a browser on my iPhone doesn't work at all. My MacBook is named Aesop, and the sharing setup says other users should be able to connect to http://Aesop.local:8080/home but safari on the iPad, iPhone, and other Macs on the local network just network times out.

I'm guessing that Catalina is getting in the way, somehow, but I haven't been able to figure out just how. Any ideas?


@twostraws  Site AdminHWS+

It's possible the macOS firewall is getting in the way, but a better idea is to use your internal IP address – try running ifconfig from the command line and looking for a local IP, such as


ifconfig offers up, but doesn't work either.

stackoverflow suggests that I use this bit of code in configure.swift:

// Define Hostname & Port to listen to ...
let myServerConfig = NIOServerConfig.default(hostname: "aesop.local", port: 8080)

and that worked! Now I can't see it on my mac when I use localhost, but I can see it fine on my mac (and other local Macs and local iPhones and local iPads) by using aesop.local. every tenticle has to be in exactly the right place for this to work, but it's beautiful when it does!

Does anyone know if it's possible to configure it so that both "aesop.local" and "localhost" work from my mac? it's not a big deal, but it could be handy for serving seperate websites from the same vapor server... or maybe I'm just getting ahead of myself :)


Have you tried changing the hostname to


For the benefit of anyone using Vapor 4, the syntax is completely different. In configure.swift, add this to func configure(_ app: Application):

app.http.server.configuration.hostname = "aesop.local" 
app.http.server.configuration.port = 8080


Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until October 1st.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.