macOS Montereyではデフォルトだとlocalhost:5000が403になる
macOS Montereyでlocalhost:5000
へアクセスするも403で一向に表示する事が出来ず少し焦ったのですが、どうやらmacOS Montereyではポート5000
と7000
がAirPlayレシーバー(1)用に予約されているようで、機能が有効の場合403となるようです。
1. 同じネットワーク上の近くにあるMac、iPhone、またはiPadからビデオやオーディオのコンテンツを受信することができる機能。
AirPlayレシーバーの設定はシステム環境設定 -> 共有
から変更する事ができ、無効にするとlocalhost:5000
のアクセスが可能になります。
ポート5000
というとローカル開発する際に使われるポピュラーなポート番号の1つなのでAppleさんの嫌がらせなのかな?と思ったのですが、どうやらそうでもないようです。(そりゃそうだ)
The Remote Audio Output Protocol, AKA AirTunes, AKA AirPlay, has been using port 5000 since the year 2004. This is nothing new. All AirPlay receivers including AirPort Express and Apple TV use port 5000. If you've ever used Airfoil on your Mac (Airfoil Speakers was released in 2008), that also uses 5000 for the same reason. AirPlay receiving is new to macOS Monterey, but AirPlay itself is very old, predating Flask and these other web development environments. No, Apple is not trying to make web development difficult.
引用: https://developer.apple.com/forums/thread/682332?answerId=693768022#693768022日本語訳:
リモートオーディオ出力プロトコル、別名AirTunes、別名AirPlayは、2004年からポート5000を使用しています。これは新しいことではありません。AirMacExpressやAppleTVを含むすべてのAirPlayレシーバーはポート5000を使用します。MacでAirfoilを使用したことがある場合(Airfoilスピーカーは2008年にリリースされました)、同じ理由で5000も使用します。AirPlayの受信はmacOSMontereyにとっては新しいものですが、AirPlay自体は非常に古く、Flaskやその他のWeb開発環境よりも前のものです。いいえ、AppleはWeb開発を難しくしようとはしていません。
個人的な希望としてはデフォルトではAirPlayレシーバー機能は無効にしていただいて、デフォルトのポートは設定から自由に指定できるようになると嬉しいなと思ったり。
先にポート5000もしくは7000が使われている時にAirPlayレシーバーを有効にした時は再割当てされる
ちなみにAirPlayレシーバーを無効にした上で先にポート5000
もしくは7000
を使いつつその後改めてAirPlayレシーバーを有効にした場合、適当なポートが割り当てられるようです。