Skip to main content
OCLC Support

How many ports does EZproxy use?

Find out how many ports EZproxy uses for proxy by hostname and proxy by port.

Proxy by hostname

To avoid the arbitrary number of ports required for proxy by port, EZproxy can operate using the recommended proxy by hostname configuration. In proxy by hostname, EZproxy uses one to three pre-identified ports for all processing:

  • one for http processing
  • an optional one for https processing
  • an optional one to allow old URLs to work if you move from using port 2048 to using port 80 for http

Using the example above, EZproxy will use rewritten URLs using the hostnames in config.txt and would represent the URLS above as follows:

  • www.somedb.com as www.somedb.com.ezproxy.yourlib.org
  • search.somedb.com as search.somedb.com.ezproxy.yourlib.org
  • www.otherdb.com as www.otherdb.com.ezproxy.yourlib.org
  • www.otherdb.com:180 as p180-www.otherdb.com.ezproxy.yourlib.org

Proxy by port

In its default configuration, EZproxy operates in proxy by port and uses one TCP port for login processing, with the first port being 2048. This port is used by EZproxy to handle user authentication. EZproxy always skips port 2049 since it is used by NFS.

In proxy by port, EZproxy creates "virtual web servers" by assigning one additional TCP port for every web host used by the databases you have configured in config.txt. As an example, EZproxy might assign the following ports to resources:

  • 2050 for www.somedb.com
  • 2051 for search.somedb.com
  • 2052 for www.otherdb.com
  • 2053 for www.otherdb.com:180

Since the ports are assigned based on the web server names chosen by database vendors, it is not possible to predict the exact number of ports that EZproxy will require for any given configuration. EZproxy will not create more than 200 virtual web servers. For information on how to change this limit, see MaxVirtualhosts.

If your site uses a firewall, it may need to be configured to allow incoming connections on these ports. Under the default limit, EZproxy will use no more than ports 2048 - 2252 (skipping 2049, which the firewall administrator may choose to leave blocked if your EZproxy system runs NFS, and 2064, 2115, and 2140, which are also commonly assigned to other services). You can also determine the highest port number in use with the administrative /status URL. Since EZproxy dynamically creates virtual web servers as needed, you should always leave at least a few extra ports available.

Highest port assigned by EZproxy in proxy by port

In default configurations using port 2048 as their start and not using any SkipPort directives, the highest port that EZproxy will assign may be found by the formula:

MaxVirtualHosts + 2052

If you have no interest to know why this is the case, you may skip the rest of this section.

The actual formula to compute the worst case highest port that EZproxy may assign is:

 FirstPort + MaxVirtualHosts + #NoUse + #SkipPort - 1

where these values are defined as:

FirstPort The first port assigned by EZproxy; default 2048
MaxVirtualHosts The value of MaxVirutalHosts; default 200
#NoUse The number of ports that EZproxy will not assign as discussed earlier in this page; default 5
#SkipPort The number of SkipPort directives in ; default 0

In the default EZproxy configuration, the worst case value is 2048+200+5+0-1 or 2252.

 Note: The highest port that can be assigned in default configuration is 2251, since #NoUse has a practical value of 4 until EZproxy reaches port 2401. The value of 5 is used throughout for convenience.