27

Since the last OSX update (Yosemite), my localhost server is full of error messages from airplay (but I am not using it). Each times it's the same:

[31/Oct/2014 05:40:42] code 400, message Bad request version ('RTSP/1.0')
[31/Oct/2014 05:40:42] "GET /info?txtAirPlay&txtRAOP RTSP/1.0" 400 -

It's just annoying to have its server full of error messages so if anyone has a clue to fix that or to remove airplay, I would be very thankful :)

Pascal
  • 16,846
  • 4
  • 60
  • 69
Insomniak
  • 443
  • 6
  • 19

4 Answers4

31

I think I found the answer: On a cisco discovery forum they listed an nmap output that revealed the Yosemite discoveryd port ranges. Turns out the Apple is using port 5000:

PORT      STATE SERVICE    VERSION
3689/tcp  open  daap       Apple iTunes DAAP 11.0.1d1
5000/tcp  open  rtsp       Apple AirTunes rtspd 160.10 (Apple TV)
7000/tcp  open  http       Apple AirPlay httpd
7100/tcp  open  http       Apple AirPlay httpd
62078/tcp open  tcpwrapped
5353/udp  open  mdns       DNS-based service discovery

As you can imagine this is the default Flask port, just change your running port to anything other than 5000, and this problem should disappear. This Flask extension https://github.com/miguelgrinberg/Flask-Runner can make your life much easier than hard coding the port in the run command.

Deano
  • 1,136
  • 10
  • 19
5

If you don't want to use Airtunes, you can turn it off in the System Preferences app, under Sharing, by unchecking the box on the left next to "Airplay Receiver":

The box is now unchecked in Sharing

Here's the before and after of unchecking the box:

# before
$ curl -I localhost:5000/
HTTP/1.1 403 Forbidden
Content-Length: 0
Server: AirTunes/600.8.1

# after
$ curl -I localhost:5000/
curl: (7) Failed to connect to localhost port 5000: Connection refused
Razzi Abuissa
  • 3,337
  • 2
  • 28
  • 29
  • Yes, thanks @razzi-abuissa this is a good and updated link to the problem. Also see https://developer.apple.com/forums/thread/682332 – Deano Feb 23 '23 at 18:48
2

Also, under Flask.run() is the port arg so you can specify which port you'd like to use, this does work for localhost.

Here is the source documentation.

Example:

from flask import Flask, Response

app = Flask(__name__)

@app.route('/')
def default():
    return Response(status=200)

if __name__ == '__main__':
    app.run(debug=True, port=12345)
Sienna
  • 1,570
  • 3
  • 24
  • 48
0

I ran into this same problem, but it turned out that I had an error in my code. I was attempting to connect to a Redis server with the wrong port number and somehow that Airplay error appeared.

I'm not sure if this fixes your problem but it may help someone else encountering the same issue as I had.

Patrick
  • 1,079
  • 1
  • 9
  • 14