I just installed PostgreSQL 10.4, and noticed that the pgAdmin 4 v3.0 interface packaged with that version uses a local web server and browser interface. By default, the application appears to use an ephemeral port (49152 to 65535) assigned by the OS (Windows 10 in my case). However, I'm working in an environment where the firewall is setup to block HTTP connections, which prevents connecting to the pgAdmin website. Is there a way to fix the port number, instead of using an OS-assigned ephemeral port?

I have looked through the pgAdmin 4 v3.0 documentation, but couldn't find anything about this type of configuration. As a work-around, I know that I can install pgAdmin 4 v2.1 using the stand-alone installer, but I hate the idea that we will never be able to upgrade if we use that approach.


The error I am getting in the web browser (IE11 on Windows Server 2016) is:


The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to suply the credentials required.

When I searched for this issue, I found the following question on StackOverflow: pg4admin 401 Unauthorized Error

That question describes my problem exactly. However, none of those answers resolved my issue. The tray application appears to be successfully binding to the correct ports (netstat -a -n appears to be correct), and there is nothing in the pgAdmin log file that looks suspicious. I will leave this question open, since fixing the port number seems like a reasonable thing to do, while I try to determine why pgAdmin isn't working.

  • Does your firewall actually block connections to localhost? That is rather unusual. May 12, 2018 at 13:36
  • I haven't confirmed that the firewall is blocking the connection. All I know is that the pgAdmin web interface isn't working due to an inability to connect to I know that a request to our IT department to open up ports on the system in question requires that we specify both a port number and protocol. Given that knowledge, and the fact it wasn't working, I made an educated guess that the firewall was to blame. Tomorrow, I'll add the text of the error message being displayed in the browser, and try to confirm what is going wrong by inspecting the log files.
    – Jeff G
    May 13, 2018 at 15:25

9 Answers 9


Your specific problem might have already been resolved, but...

It is possible to configure a fixed port for pgAdmin 4:

  1. Click on the pgAdmin 4 tray-icon
  2. Click "Configure..."
  3. Check the box labeled "Fixed Port Number?"
  4. Enter the desired port number in the field next to it



Ran into this problem on Windows Server 2016 with pgAdmin4 v3.5 - resolved it by setting "IE Enhanced Security Configuration" to OFF - can then immediately access the management pages (note - 'run as Administrator' was not required).

  • This is what resolved my issue, but I accepted another answer that addresses the title of the question in order to more efficiently help others that end up on this page.
    – Jeff G
    Apr 10, 2020 at 16:55

Had the same issue in the following setup: Kubuntu 18, Firefox 64.0

What worked for me:

  1. Context menu > Copy server URL. That will give us an url of form:

  2. Navigate to that URL via browser (in my case Firefox worked well)

The following did not help:

  • Context menu > New pgAdmin 4 window...

  • Uninstall & install pgAdmin 4

  • Clear cookies for

  • Restart pgAdmin4

Hope this helps someone.


I had the same issue and solved it by installing a different browser.  In my case it was "Google Chrome" and set them as "default".


  • stop pgadmin4
  • install Google Chrome
  • set Google Chrome to default
  • start pgadmin4

I loved pgadmin4, so I tried all of the solutions I could find. But nothing worked, so I'm using pgadmin3, which was still installed from a prior version of postgres.


I found that you can't just open that address in a browser (at least not for the first time). You have to open it from the pgAdmin tray icon -> New pgAdmin4 window....

If it's not there and you have problem with running pgAdmin4 at all then try to find psql.exe inside the installation directory:

C:\Program Files (x86)\pgAdmin 4\v3\runtime

and run psql.exe before running pgAdmin4.exe.

If that still doesn't help, try to set different default browser in your system.


The Unauthorized message indicates a successful HTTP connection as it is read from the HTTP server. It appears when you don’t have the right authorization cookie.

When pgAdmin 4 is run in desktop mode, you have to right-click on its tray icon and select New pgAdmin 4 window. Make sure you have cookies enabled. If you use a whitelist, you have to set a permission for the used port which changes every time pgAdmin starts.

Update: pgAdmin 4 3.2 is released. You can now copy the URL including the key for using any browser (profile) you like which has the required cookie permissions. You can also set a fixed port number so you can create a cookie permission exception rule in your default browser (profile).

  • Unfortunately, enabling cookies and adding to the "Trusted sites" list didn't work for me.
    – Jeff G
    Jul 18, 2018 at 22:31
  • @JeffG Adding only creates an exception for port 80 (the default port for HTTP). You have to select New pgAdmin 4 window, check which port it actually uses (in the private/dynamic range 49152–65535), create a matching exception (for example for, then select New pgAdmin 4 window again (because this opens a URL which tries to set an authentication cookie and then redirects to another URL which doesn’t, so reloading the latter doesn’t help). When you start pgAdmin the next time, you have to repeat this because it very likely uses a different port.
    – Martin
    Jul 19, 2018 at 8:09

Unfortunately, in my Windows 10 environment the accepted answer was not applicable since the configuration options were not enabled via the tray icon. What helped me is the registry settings at the HKEY_CURRENT_USER\Software\pgadmin\pgadmin4 path. It contained the keys to enable a fixed port and to specify the exact port number. Source: pgAdmin documentation.


delete the cookies from the browser settings, if you are going to reinstall pgadmin. example: Firefox --> Options --> Privacy & Security --> Cookies and Site data --Clear Data Find and clean or find localhost and clean

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .