ERR_UNSAFE_PORT

2024, Oct 29    

I did the usual ssh portforward

ssh someserver -L 10080:127.0.0.1:5000

Connecting using Brave gave me this interesting error

Firefox does the same.

ERR_UNSAFE_PORT means that you are trying to connect a port (10080in this case) that is on the built-in list of ports that the browser will not serve. This is a security feature to avoid malicious javascript connecting directly to vulnerable services.

The list of ports is in the code here. If you must, you can whitelist a port. In Firefox it is in about:config. For chrome, you can use the --explicitly-allowed-ports command line parameter.

The easy solution is to use a different port.