WSO2 AM Default Server IP Address - wso2

I've setup WSO2 API Manager on Ubuntu and everything seems to be working, except, when I go into the API Store and under API Console. When I want to "Try It Out", it doesn't work.
But more specifically, when it fails, it shows the curl command, and it is showing the incorrect IP address for my server. It is showing the default address of: 172.17.0.1
My Question is how to change this.
I have gone into /repository/conf directory and updated the carbon.xml file to change the HostName and MgtHostName settings to reflect my server's IP address.
Is there another place to set something so that 172.17.0.1 is no longer used or referenced?

Change the <GatewayEndpoint> URLs with the correct hostname, in api-manager.xml
<APIGateway>
<!-- The environments to which an API will be published -->
<Environments>
<!-- Environments can be of different types. Allowed values are 'hybrid', 'production' and 'sandbox'.
An API deployed on a 'production' type gateway will only support production keys
An API deployed on a 'sandbox' type gateway will only support sandbox keys
An API deployed on a 'hybrid' type gateway will support both production and sandbox keys. -->
<!-- api-console element specifies whether the environment should be listed in API Console or not -->
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<!-- Server URL of the API gateway -->
<ServerURL>https://localhost:${mgt.transport.https.port}${carbon.context}services/</ServerURL>
<!-- Admin username for the API gateway. -->
<Username>${admin.username}</Username>
<!-- Admin password for the API gateway.-->
<Password>${admin.password}</Password>
<!-- Endpoint URLs for the APIs hosted in this API gateway.-->
<GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port}</GatewayEndpoint>
<!-- Endpoint of the Websocket APIs hosted in this API Gateway -->
<GatewayWSEndpoint>ws://${carbon.local.ip}:9099</GatewayWSEndpoint>
</Environment>
</Environments>
</APIGateway>

showing the incorrect IP address for my server. It is showing the default address of: 172.17.0.1
it show an IP address found as local IP (so it may be a docker container or another of your IP addresses)
As already answered, the address can be changed as GatewayEndpoint parameter
When I want to "Try It Out", it doesn't work
Now I will assume that the default certificate is not trusted for the url. Though you may try to open the dev console in the browser and find out more information about it doesn't work
Please note the service port (8243) is different that the management port (9443) so the ssl certificate may not be trusted by the browser for the url
When having a self-signed ssl certificate, try to put the URL in the curl command to your browser and trust the certificate. Then try to call the API again

Related

Authorized redirect URIs of OAuth 2.0 Client ID for an Web application in Google Cloud Platform has been classified as abusive, not allowed to proceed

I am trying to set up Google Integration in my self-hosted Nextcloud instance. For this I need a Google Cloud API Web application OAUTH Client ID and Secret, along with the preset Authorized redirect URI from my Nextcloud instance. I can easily create the ID and Secret for the Web app. But, if I put the Authorized redirect URI in the Google Cloud OAUTH page, it tells me "Save failed: The request has been classified as abusive and was not allowed to proceed".
For context, the Domain provided is a Google Domain which I am using with a Cloudflare proxied DNS. Google verification TXT record have been added to Cloudflare. I am self-hosting the Nextcloud instance with a subdomain of this domain behind an Nginx Proxy Manager with a Cloudflare SSL certificate. To add, all of these are running as docker containers on Ubuntu. Additionally I have also verified the Redirect URI as Safe from: https://global.sitesafety.trendmicro.com/result.php
Even then, apart from that specific URI, I have tried URI of other services I am self-hosting as well as the parent domain. All of these are giving the same message from the GCP OAUTH screen.
Kindly help me out with this considering I am fairly a novice.

WSO2 Distributed setup - no access to API via Gateway

I read a lot of information about this topic but I have no answer.
I have 3 servers with following components
server1 - WSO2 IS + OpenLDAP
server2 - WSO2 Gateway
server3 - Publisher + Store
All of theese servers working with LDAP and I have no problems to login to IS, Gateway, publisher and store with my Ldap login.
In Publisher config file I wrote Gateway server2 but when I publish new test API I have access to this API (server3:8243/ddd/v1/aaa), but via gateway I have no access https://server2:8243/ddd/v1/aaa and I got an Error 404.
How I need to configure my WSO2 Publisher or Gateway.
P.S. At this moment I have no genereated ssl keys in a keystore. Can you tell me how to resolve this problem for testing my TEST API?
When you publish an API from the publisher, it pushes the Synapse artifact of the API to the gateway node. But in your case, as you haven't changed any configuration in Publisher/Store node, it points to the server itself.
You can edit the server 3 and point server 2 which is your gateway node. Edit the api-manager.xml file in APIM/repository/conf location.
<APIGateway>
<Environments>
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<ServerURL>https://[API-Gateway-Host-or-IP]:9443/services/</ServerURL>
<Username>${admin.username}</Username>
<Password>${admin.password}</Password>
<GatewayEndpoint>http://[API-Gateway-Host]:8280,https://[API-Gateway-Host]:8243</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>

WSO2 API Manager, new gateway endpoint not woking

I have hosted WSO2 API Manager into my virtual machine with static ip address.
I can open my Carbon, Publisher and Store page by entering these addresses:
https://my.ip.address:9443/publisher
https://my.ip.address:9443/store
https://my.ip.address:9443/carbon
When I add my API in my publisher page, it creates endpoint in 172.x.x.x.x address which is only for internal use.
So in order to have access to my endpoints outside I have written these lines in my \wso2\wso2am-2.1.0\repository\conf\api-manager.xml into APIGateway:
<APIGateway>
<Environments>
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<!-- Server URL of the API gateway -->
<ServerURL>https://localhost:${mgt.transport.https.port}${carbon.context}services/</ServerURL>
<!-- Admin username for the API gateway. -->
<Username>${admin.username}</Username>
<!-- Admin password for the API gateway.-->
<Password>${admin.password}</Password>
<!-- Endpoint URLs for the APIs hosted in this API gateway.-->
<GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port},http//my.ip.address:${http.nio.port},https://my.ip.address:${https.nio.port}</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>
Now when I publish my APIs Production and Sandbox URLs are:
http://my.ip.address:8280/path/to/my/api
https://my.ip.address:8243/path/to/my/api
However, when I try to make requests to my API urls, I get timeout errors.
Why this is happening?
The main problem was that my system administrator didn't open 8280 and 8243 ports for users that outside of local network.

wso2 api-manager configurations for cluster environment

Environment
So I have a Clustered environment with an API Manager and two gateway workers (the gateways are on a load balancer) and two Identity Servers as Key Managers (Load Balancer).
I get confused when it comes to configuring the below code.
<Environment type="hybrid" api-console="true">
<Name>Production and Sandbox</Name>
<Description>This is a hybrid gateway that handles both production and sandbox token traffic.</Description>
<!-- Server URL of the API gateway -->
<ServerURL>https://gatemgrdev.byui.edu/services/</ServerURL>
<!-- Admin username for the API gateway. -->
<Username>${admin.username}</Username>
<!-- Admin password for the API gateway.-->
<Password>${admin.password}</Password>
<!-- Endpoint URLs for the APIs hosted in this API gateway.-->
<GatewayEndpoint>http://${carbon.local.ip}:${http.nio.port},https://${carbon.local.ip}:${https.nio.port}</GatewayEndpoint>
</Environment>
</Environments>
</APIGateway>
In my Identity Servers I usually point the Server URL to my API Manager. Like so
<ServerURL>https://apimgr.org/services/</ServerURL>
In my API Manager I usually change the configs to this
<GatewayEndpoint>http://gateworker.org,https://gateworker.org</GatewayEndpoint>
So how should I configure the gateway workers? Do I have to do anything to them? Also, I'm I configuring the two above correctly?
You can find the gateway configurations from [1]
[1] https://docs.wso2.com/display/AM210/Clustering+the+API+Manager#ClusteringtheAPIManager-ConfiguringtheGateway
Thanks
Isura.

Should I use localhost in the endpoint address of a WCF service?

If I host a publicly available WCF web service in IIS, how should I configure the endpoint address? I think I can use either:
<endpoint address="http://localhost/MyService" ... />
or
<endpoint address="http://example.com/MyService" ... />
In both cases, a client on another machine must use the second option for its client binding.
If I use Visual Studio to create the client, both server bindings seem to work fine. However, I think I had trouble using new-webserviceproxy in Powershell with the first option.
Does it matter which one I use on the server?
MSDN: Specifying an Endpoint Address:
you must use relative endpoint addresses for IIS-hosted service endpoints. Supplying a fully-qualified endpoint address can lead to errors in the deployment of the service. For more information, see Deploying an Internet Information Services-Hosted WCF Service.
From that link:
When hosted in IIS, endpoint addresses are always considered to be relative to the address of the .svc file that represents the service. For example, if the base address of a WCF service is http://localhost/Application1/MyService.svc with the following endpoint configuration.
<endpoint address="anotherEndpoint" .../>
This provides an endpoint that can be reached at http://localhost/Application1/MyService.svc/anotherEndpoint