87
25
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?
87
25
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?
75
On Windows:
Right Click on Chrome shortcut >> Properties >>
Then Append
--explicitly-allowed-ports=xxx
to shortcut target
Example:
C:\Documents and Settings\User\Local Settings\Application Data\Google\Chrome\Application\chrome.exe --explicitly-allowed-ports=6666
Resource from here
18
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?
2Why just making an HTTP request on a non standard port it is said to "open" the browser to being an open proxy to attack services in local network? Open how?? – jj_ – 2016-07-22T19:59:05.443
If it is left unchecked then any malicious code can make request to URLs with arbitrary ports. It might not be an optimal solution but by blocking other ports you are only leaving attackers with 80 & 443 to exploit. – Willa – 2017-01-23T14:39:47.940
the referenced link is now dead – Jeff Puckett – 2017-06-13T15:41:15.090
Link is now dead. Wayback Machine: https://web.archive.org/web/20170216040700/https://jazzy.id.au/2012/08/23/why_does_chrome_consider_some_ports_unsafe.html (suggested edit)
– Nulano – 2017-06-26T17:54:42.223Link is now fixed on the server (server had an incorrectly configured timezone causing it to serve the blog post at the wrong date). – James Roper – 2017-06-27T13:47:16.250
9
On Mac you can create an app launching Chrome with parameters mentioned in other answers using Automator built-in Apple application:
Launch Automator
As "Type of document" choose "Application"
Add action "Run shell script"
Replace placeholder 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!)
Source: http://cubewot.de/node/266
This picture does not have the full path. It is automating the execution of a directory. – ojblass – 2018-09-19T04:27:58.360
4
For Mac:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --explicitly-allowed-ports=5000,6000,7000
for ports 5000, 6000, and 7000.
3
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: -explicitly-allowed-ports=5000,6000,7000
)
NOTE: for UNIX, the switch does NOT start with "--", it does with a single "-"
FWIW, the --
on unix is a GNU-specific convention. It's emulated by many, but not all unix utilities. – jpaugh – 2019-04-18T14:54:31.923
0
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.
For example
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.
Thank you.
2
I missed this answer, thanks. I opened a separate question to understand which ports are safe/blocked by default: http://superuser.com/questions/188058/which-ports-are-considered-unsafe-on-chrome
– ripper234 – 2010-09-13T12:36:59.6702This answer is excellent... for Windows. It won't solve the problem for (for example) Mac. – Chris R – 2012-05-03T17:23:22.693
@ChrisR: Why? Does the
--explicitly-allowed-ports
switch not exist for Mac? – Dennis – 2012-05-03T17:35:52.5032Adding command line flags on the mac is a pain in the ass; if you add them to the app bundle they often get nuked in upgrades. – Chris R – 2012-05-03T17:39:51.667
@ChrisR: You should consider adding this to your question. – Dennis – 2012-05-03T17:44:00.620