WSO2 API Manager - Displaying Private IP in the st

2019-05-12 00:23发布

问题:

I have installed the API manager 1.6.0 and got API Manager running as well. However the problem is IP address shown within store is the private IP of the server. Private IP is accessed via a VPN.

Below is the URL which is shown in the store as Production and Sandbox URLs,

http://192.168.6.162:8280/railway/2.0

For 192.168.6.162 I have assigned a public IP which is 103.11.35.xx and assigned a domain my-domain-name as well.

What I would like to see is as below,

http://my-domain-name/railway/2.0

How can I configure API Manager to show the domain name instead of an IP address with a port?

回答1:

You can set this from api-manager.xml. Under APIGateway section there's the GatewayEndpoint element in which you can specify the URLs which should be shown in the store.

<APIGateway>

<Environments>
            <Environment type="hybrid">
                    <Name>Production and Sandbox</Name>
                    <ServerURL>https://localhost:9445/services/</ServerURL>
                    <Username>admin</Username>
                    <Password>admin</Password>
    **<GatewayEndpoint>http://localhost:8282,https://localhost:8245</GatewayEndpoint>**
            </Environment>
    </Environments>

    <EnableGatewayKeyCache>true</EnableGatewayKeyCache>

<ClientDomainHeader>referer</ClientDomainHeader>

</APIGateway>


回答2:

Edit api-manager.xml file located in WSO2-HOME/repository/conf, and set the GatewayEndpoint to http://mydomainname.com

<Environment type="hybrid">
                    <Name>Production and Sandbox</Name>

                    <ServerURL>https://${carbon.local.ip}:${mgt.transport.https.port}/services/</ServerURL>

                    <Username>admin</Username>

                    <Password>admin</Password>

                    <GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port}</GatewayEndpoint>
            </Environment>


回答3:

Below Configuration worked for me.

You can also change the Hostname Value in carbon.xml with your Ws02 API Manager DNS entry or System Public IP address.

"<HostName>{hostname}</HostName>"

https://docs.wso2.com/display/AM210/Changing+the+Hostname