Page 1 of 1

Allow port

Posted: Mon May 09, 2022 1:08 pm
by dilfich
Hi!

Failed to load URL http://.........:4045 with error ERR_UNSAFE_PORT (-312).

MiniBrowser

Code: Select all

procedure CreateGlobalCEFApp;
begin
  GlobalCEFApp                     := TCefApplication.Create;
  GlobalCEFApp.cache               := 'cache';
  GlobalCEFApp.EnablePrintPreview  := True;
  GlobalCEFApp.EnableGPU           := True;
  GlobalCEFApp.LogFile             := 'debug.log';
  GlobalCEFApp.LogSeverity         := LOGSEVERITY_INFO;
  GlobalCEFApp.AddCustomCommandLine('--explicitly-allowed-ports=4045');
end;
Does not work, in a normal browser, if you specify through the shortcut works, what is wrong?

Re: Allow port

Posted: Tue May 10, 2022 9:16 am
by salvadordf
Try replacing this line :

Code: Select all

GlobalCEFApp.AddCustomCommandLine('--explicitly-allowed-ports=4045');
with this line :

Code: Select all

GlobalCEFApp.AddCustomCommandLine('--explicitly-allowed-ports', '4045');
Navigate to "chrome://version" to see all the switches and compare the switches between the application with AddCustomCommandLine and the application that has a command line switch in the shortcut.

Re: Allow port

Posted: Tue May 10, 2022 9:39 am
by dilfich
Thank you, yes it really works so well. :)

Re: Allow port

Posted: Fri May 20, 2022 11:50 am
by dilfich
While this is not necessary, but the question arises, how to resolve any port? :?:
It is not very convenient to add each time, it is only necessary if there is a need for such a restriction yourself, but if it is not necessary, then it is not necessary.

Re: Allow port

Posted: Sat May 21, 2022 7:48 am
by salvadordf
Chromium added this feature for security reasons :
https://superuser.com/questions/188058/which-ports-are-considered-unsafe-by-chrome
https://jazzy.id.au/2012/08/23/why_does_chrome_consider_some_ports_unsafe.html
https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc

Apparently, you can specify several ports separated by commas when you use that switch :
https://superuser.com/questions/188006/how-to-fix-err-unsafe-port-error-on-chrome-when-browsing-to-unsafe-ports