I'm getting this error when connecting to a web server on port 6666 (http://myserver:6666/):
Error 312 (net::ERR_UNSAFE_PORT): Unknown error.
Is there an easy way to resolve this without rebuilding Chrome from source?
Right Click on Chrome shortcut >> Properties >>
--explicitly-allowed-ports=xxx to shortcut target
C:\Documents and Settings\User\Local Settings\Application Data\Google\Chrome\Application\chrome.exe --explicitly-allowed-ports=6666
Resource from here
You may be able to turn this off in Google Chrome, but you do so at your own risk. There is actually a good security reason why Chrome blocks these ports: Basically you open your browser up to being an open proxy for attackers to use to attack other services on your network.
For more information: Why does Chrome consider some ports unsafe?
On Mac you can create an app launching Chrome with parameters mentioned in other answers using Automator built-in Apple application:
As "Type of document" choose "Application"
Add action "Run shell script"
cat script in this action with:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --explicitly-allowed-ports=5000,6000,7000
Save the created app as something like "Google Chrome with allowed unsafe ports" in your Application folder
Use this new app instead of Google Chrome directly
(optional) Replace default icon of the created "app" - Automator's robot - with Chrome's using this method (note: upvote that answer if you like it!)
As subanki said, you've got to add the
-explicitly-allowed-ports option to your Chrome startup command.
In Ubuntu you can do this (as root) by editing the "google-chrome" script under your Chrome installation folder
You can get the directory by typing:
ls -la /usr/bin | grep chrome
Then, edit the "google-chrome" file adding the mentioned switch to the EXEC line:
exec -a "$0" "$HERE/chrome" "-explicitly-allowed-ports=6000" "$@"
Just change "6000" with the comma separated values you might need (example:
NOTE: for UNIX, the switch does NOT start with "--", it does with a single "-"
Here is the correct answer for those of you who are developers using node.js as a web server
Change the port you are using to host your web pages.
if you typed into command line node index.js & pressed enter,
if it started running on port 22 for 80 http request,
when you visit the website at port 22,
the chrome browser with throw this error page.,br> keyword UNSAFE PORT means port needs to match the content.