http://localhost stopped working following my Sonoma upgrade

Following my Sonoma update, my http://localhost stopped working.


I did sudo apachectl start, and got the following message: httpd (pid2357 already running)

MacBook Pro 16″, macOS 14.0

Posted on Sep 29, 2023 10:24 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 9, 2023 7:40 AM

C_ASB wrote:

System Settings -> General -> AirDrop & Handoff -> AirPlay Receiver

If AirPlay Receiver is enabled localhost might not work.
Try disabling it. It worked for me

That's the default setting. I've never touched it.


It seems like AirPlay Receiver was introduced in Monterey and used ports 5000 and 7000. So if you had configured your own Apache to run on those ports, then you would need to disable AirPlay Receiver. I recommend using standard web server ports like 80, 8000, or 8080 instead.

17 replies
Question marked as Top-ranking reply

Oct 9, 2023 7:40 AM in response to C_ASB

C_ASB wrote:

System Settings -> General -> AirDrop & Handoff -> AirPlay Receiver

If AirPlay Receiver is enabled localhost might not work.
Try disabling it. It worked for me

That's the default setting. I've never touched it.


It seems like AirPlay Receiver was introduced in Monterey and used ports 5000 and 7000. So if you had configured your own Apache to run on those ports, then you would need to disable AirPlay Receiver. I recommend using standard web server ports like 80, 8000, or 8080 instead.

Sep 29, 2023 2:18 PM in response to John Galt

That was the #1 returned link if you google the issue using Chrome, so I've already seen it, and it's not really relevant to me, because I had a web server working.


It turns out the problem is that Require host localhost was missing from my configuration file. This is now required in the version of Apache2 that ships with Sonoma.


If I had modified my configuration, based on the instructions in that article, it would have messed everything up, or at a minimum, configured things that would overly complicate stuff.

Sep 29, 2023 4:21 PM in response to JosephMo

JosephMo wrote:

That was the #1 returned link if you google the issue using Chrome, so I've already seen it, and it's not really relevant to me, because I had a web server working.

had

It turns out the problem is that Require host localhost was missing from my configuration file. This is now required in the version of Apache2 that ships with Sonoma.

Require host localhost is not required. Apache's security model is complicated. I'm pretty clear in that article that it's only designed for local testing.


However, if you do want to use some other setting, it will work fine. For example, if you wanted to test from a mobile device or simulator, then you would have to open that up. You could use Require all granted to allow global access. A better idea would be to review Apache's documentation and configure your server for the least possible access.

If I had modified my configuration, based on the instructions in that article, it would have messed everything up, or at a minimum, configured things that would overly complicate stuff.

Colour me skeptical. 😄

Sep 29, 2023 4:03 PM in response to JosephMo

JosephMo wrote:

"localhost" is a reserved domain name that always refers to the current device's loopback network interface, and is used in many contexts (DB server, testing network interfaces, etc). But http://localhost is used to access the local web server. If you can think of anything else, I would love to know.


Yes. For example, http://localhost:631 is used for the CUPS interface.


You're welcome.

Oct 9, 2023 8:21 AM in response to JosephMo

JosephMo wrote:

I did not configure my web server to run on these ports. I posted the answer.

I didn't say you did. I was replying to C_ASB's post.


This is a problem on these forums. People aren't going to read and look for the correct answer. They are just going to randomly pick something, probably the last post made by someone else who didn't read to look for the correct answer. Then, what that "solution" invariably fails, they get frustrated.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

http://localhost stopped working following my Sonoma upgrade

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.