WSO2 API Manager Ports - wso2-api-manager

I am having a requirement to publish all APIs developed to run on ports 80 and 443 instead of 8280 and 8243.
I changed the axis2.xml as below and restarted the API Manager server.
<parameter name="port" locked="false">80</parameter>
<parameter name="port" locked="false">443</parameter>
I can see published APIs in API store showing 80 and 443 ports respectively.
But when I am trying to test it using Postman like below URL, it throws the below error.
URL: http://localhost:80/pizza & https://localhost:443/pizza
Error: HTTP Error 404. The requested resource is not found.
Please suggest if there is any configuration missing.
Thanks.

I don't think you can do that. If you want to expose your APIs with 80/443, you need to front APIM with a reverse proxy as explained in [1].
[1] https://docs.wso2.com/display/AM210/Adding+a+Reverse+Proxy+Server

Related

Binding web address to localhost

I'm trying to implement a card payment provider to my web shop, but it only accepts a real URLs as success, error and cancel callbacks. For example, the success callback should be https://www.mywebshop.com/Checkout/PaymentSuccessful
As I want to test the mentioned functionality locally, I need to set the payment success callback to https://localhost:44328/Checkout/PaymentSuccessful, but the card payment provider don't accept it (it redirects to error callback instantly).
So, I guess I should add following rows to my hosts file:
127.0.0.1 mywebshop.com
127.0.0.1 www.mywebshop.com
Unfortunately, that didn't work - the local app is running but when I request mywebshop.com, I got messages below (I also tried with https/http/www)
This site can’t be reached
mywebshop.com refused to connect.
When I add a port, like https://mywebshop.com:44328/, I got error:
Bad Request - Invalid Hostname
HTTP Error 400. The request hostname is invalid.
If I add following binding to my applicationhost.config, nothing changes.
<binding protocol="https" bindingInformation="*:44328:mywebshop.com" />
<binding protocol="https" bindingInformation="*:44328:www.mywebshop.com" />
I also tried adding URL reservations with netsh, but it was unsuccessful.
You can use Ngrok for your testing. Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels. Please check how it works page here and its documentation here. Their free plan is sufficient for testing.
So download ngrok and run the ngrok.exe. Run below command which will give you public url - something like http://4a950b92.ngrok.io/ which will point to your local site. Hopefully that will solve your problem.
ngrok http -host-header=localhost 8080

Why after adding proxyPort in wso2 api manager 3.2.0, can not accsess directly to https://api.am.wso2.com:443/publisher?

I want to use Nginx revers proxy as load balancer, but after adding proxyPort in wso2 api manager 3.2.0 deployment.toml :
[transport.https.properties]
proxyPort = 443
I can not accsess directly to https://api.am.wso2.com:443/publisher?
Also my hostname = "api.am.wso2.com"
cloud please guide me?
Once the proxyPort is enabled, you need to at least have an Nginx instance running with the relative configurations to access the API Manager. You can find the default Single node Nginx configurations in here.
Therefore, this is expected behavior. As an alternate, you can disable the Proxy Port configurations and only configure the Hostname in the TOML and try accessing the portals.

Getting '405 Not Allowed' for PUT/POST Methods in postman in mule 4

I have created a mule application with client_id and client_secret, TLS keystore and deployed on cloudhub. I am able to run application locally but cannot run with cloudhub url.
URL: https://system.us-e2.cloudhub.io/api/refund with PUT method with json body.
It is throwing '405 Not Allowed'
Thanks in advance
Probably you are not pointing to the right application. The error is coming from CloudHub load balancer, indicating that it didn't reach your application. Check that the URL used is the right one for the application. Also that the application is listening in the right port. For CloudHub an HTTPS listening application has to listen in port 8082.
You can try to troubleshoot by contacting directly the application's worker. For example: https://mule-worker-system.us-e2.cloudhub.io/api/refund:8082/...
Your application should have an HTTP Listener configuration like:
<http:listener-connection host="0.0.0.0" port="8082" protocol="HTTPS">
<tls:context>
<tls:trust-store path="keystore.jks" password="123456"/>
</tls:context>
</http:listener-connection>
Note that in this configuration the port used is "8082".

WSO2 /token resource not found

I'm trying to get a token to use in a call to a service published through WSO2 API Gateway and for that I'm calling the /token resource on https://:8243/token with a POST method and "grant_type=client credentials" and the correct Authorization header but the server returns 404 resource /token not available
If I use the Curl call generated using the "store" application I get the same error.
If I use the resource through the carbon application everything works though, I make the call to https://:9443/oauth2/token and I get the token back
Could anybody help me getting the application on the 8243 port to work?
Thanks
apimanger serves https api calls in port 8243 and http api call in port 8280 and it is defined under transportReceiver in the axis2.xml /repository/conf/axis2/axis2.xml).
Even though it is listening 8243 , if that port is not opened to outside from your server, then you will not be able to access via port 8243.So
Check whether port 8243 is opened in your server where apimanger gateway runs .You can use telnet command and check whether you are able to connect to it.
Check if in < APIM > /repository/deployment/server/synapse-configs/default/api you find the _ TokenAPI _ .xml
I had the same issue and found the file renamed with .back. Removing the .back extension and restarting the server worked.

WSO2 API Manager: How to listen PassThroughHttpListener on single IP address

When I start the WSO2 AM, I see that AM is listing to all IP-adresses on the server:
PassThroughHttpListener Pass-through HTTP Listener started on 0.0.0.0:8280
I want to bind to a single IP address. IMHO I thing I should change the axis2.xml file? I should change all
<transportReceiver name="http"
class="org.apache.synapse.transport.passthru.PassThroughHttpListener">
...
<parameter name="bind-address" locked="false">172.29.4.97</parameter>
Is this correct?
As in the comments; Issue is not implemented in PassThrough Listener, issue logged: https://wso2.org/jira/browse/APIMANAGER-2001

Resources