This documentation is for WSO2 API Manager 1.4.0 View documentation for the latest release.
Configuring Port Offset - API Manager 1.4.0 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata
Port offset allows you to run multiple WSO2 products, multiple instances of a WSO2 product, or multiple WSO2 product clusters on the same server or virtual machine (VM). Port offset defines the number by which all ports defined in the runtime such as the HTTP/S ports will be offset. For example, if the default HTTP port is 9763 and the portOffset is 1, the effective HTTP port will be 9764. Therefore, for each additional WSO2 product instance, set the port offset to a unique value (the default is 0) so that they can all run on the same server without any port conflicts.

Port offset can be passed to the server during startup. The following command starts the server with the default port incremented by 3.
./ -DportOffset=3

Alternatively, you can set it in the Ports section of <PRODUCT_HOME>/repository/conf/carbon.xml as follows:

Changing endpoints of default APIs

After offsetting a port, be sure to edit any hard-coded endpoints used in a product, if there are any, according to the offset. There are few default APIs deployed in the API Manager with hard-coded endpoints. For example, the Login API's Token endpoint URL is hardcoded as follows: <address uri="https://localhost:9443/oauth2endpoints/token"/>. If you offset the keymanger node's port by 2, change the token endpoint URL to <address uri=" https://localhost:9445/oauth2endpoints/token "/>.

Find all default APIs of the API Manager in <APIM_HOME>/repository/deployment/server/synapse-configs/default/api folder. Few examples are Authorize API, Login API, Token API and Revoke API.

Changing the Thrift client and server ports

The port offset specified earlier in carbon.xml does not affect the ports of the Thrift client and server because Thrift is run as a separate server within the Carbon server. Therefore, you must change the Thrift ports separately using <ThriftClientPort> and <ThriftServerPort> elements in the <APIM_HOME>/repository/conf/api-manager.xml file. For example, the following configuration sets an offset of 2 to the default Thrift port, which is 10397:

        Configurations related to enable thrift support for key-management related communication.
        If you want to switch back to Web Service Client, change the value of "KeyValidatorClientType" to "WSClient".
        In a distributed environment;
        -If you are at the Gateway node, you need to point "ThriftClientPort" value to the "ThriftServerPort" value given at KeyManager node.
        -If you need to start two API Manager instances in the same machine, you need to give different ports to "ThriftServerPort" value in two nodes.
        -ThriftServerHost - Allows to configure a hostname for the thrift server. It uses the carbon hostname by default.


When you run multiple instances of the API Manager in distributed mode, the Gateway and Key Manager can reside on two different JVMs. Assume that the offset of the Gateway is 2 and the offset of the Key Manager is 5 and the default Thrift port is 10397. If the Thrift ports are changed by the offsets of Gateway and Key Manager, the Thrift client port (Gateway) will now be 10399 while the Thrift server port (Key Manager) will change to 10402. This causes communication between the Gateway and Key Manager to fail because the Thrift client and server ports are different.

To fix this, you must change the Thrift client and server ports of Gateway and Key manager to the same value. In this case, the difference between the two offsets is 3, so you can either increase the default Thrift client port by 3 or else reduce the Thrift server port by 3.

  • No labels