Docker port fowarding working on IPv6 but not IPv4
Found the culprit: pfctl
AFAIK, pfctl
is not supposed to run automatically but my /System/Library/LaunchDaemons/com.apple.pfctl.plist
said otherwise.
The Packet Filtering was configured to redirect all incoming traffic on port 80 to 8080, and 443 to 8443. And this is done without any process actually listening to port 80 and 443, that's why lsof
and netstat
wouldn't show anything,.
/Library/LaunchDaemons/it.winged.httpdfwd.plist
has the following
<key>ProgramArguments</key> <array> <string>sh</string> <string>-c</string> <string>echo "rdr pass proto tcp from any to any port {80,8080} -> 127.0.0.1 port 8080" | pfctl -a "com.apple/260.HttpFwdFirewall" -Ef - && echo "rdr pass proto tcp from any to any port {443,8443} -> 127.0.0.1 port 8443" | pfctl -a "com.apple/261.HttpFwdFirewall" -Ef - && sysctl -w net.inet.ip.forwarding=1</string> </array> <key>RunAtLoad</key>
The solution was simply to listen on ports 8080 and 8443. All requests to ports 80 and 443 are now being redirected transparently.
While debugging this I found countless open questions about similar problems without answers. I hope this helps somebody.