为什么 WSO2 API Manager 使用 8243 而不是 443 调用已注册 HTTPS API 的端点?我无法到达我的最终服务 [英] Why WSO2 API Manager call the endpoint of a registered HTTPS API using 8243 instead 443? I can't reach my final service

查看:17
本文介绍了为什么 WSO2 API Manager 使用 8243 而不是 443 调用已注册 HTTPS API 的端点?我无法到达我的最终服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 WSO2 API Manager 存在以下问题(我正在开发 WSO2 API Manager 6.2.0 版本).

我在发布者门户上发布了一个 API.此 API 需要通过 HTTPS 协议的 POST 请求,并将 JSON 负载作为请求正文.

问题是发布的 API 生成了一个像这样的 cURL 请求:

curl -k -X POST "https://MY_SERVER:8243/puntualitest/v1.0.0/puntuali" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"header\": { \"msgUid\": \"a36bea3f-6dc6-49d7-9376-XXXXXXX\", \"timestamp\": 1567060509108, \"metadata\": { \"TRACKER_BIZID_REV_COD": \"7175\", \"TRACKER_BIZID_REV_NUMERO\": \"545/2019\" }, \"codApplication\": null, \"codEnte\": null, \"invocationContext\": null, \"caller\": \"SRW\", \"user\": null, \"service\": \"crediti.invioPosizioneCreditoria\" }, \"body\": { \"@dto\": \"binary\", \"内容\": \"PD94bWwgdmVyc2lvbj ...........+\" }}"

问题在于,如您所见,它试图在 8243 端口上调用最终端点,而不是在标准的预期 443 端口上调用HTTPS 端口.

因此该调用以连接被拒绝消息错误结束,因为最终端点侦听443而不是8243.>

所以我有一些问题:

  1. 如果选择的协议是 HTTPS,为什么 WSO2 API 管理器会尝试在 8243 上而不是在 443 端口上调用最终端点强>,理论上,适用于 443?

  2. 有没有办法设置必须使用的最终端点端口是443?

谢谢

解决方案

如果您采用生产案例,您的网关通过负载均衡器公开,并在端口 443 中公开.从 lb 您可以将负载均衡到 8243 网关服务器.您可以参考 [1] 设置负载均衡器.

如果需要,您可以更改端口 8280 和 8243.为此,您可以更改位于存储库/conf/axis2 位置的axis2.xml 文件中的端口.

<参数名称=端口"锁定=假">8280</参数><parameter name="non-blocking" locked="false">true</parameter><!--parameter name="bind-address" locked="false">主机名或 IP 地址</parameter--><!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter--><parameter name="httpGetProcessor" locked="false">org.wso2.carbon.mediation.transport.handlers.PassThroughNHttpGetProcessor</parameter><!--<parameter name="priorityConfigFile" locked="false">优先级配置文件的位置</parameter>--></transportReceiver>

在端口值中,您可以将其更改为 80,并且可以为端口 8243 找到 https 的类似定义.

[1] - https://docs.wso2.com/display/AM210/Configuring+the+Proxy+Server+and+the+Load+Balancer#ConfiguringtheProxyServerandtheLoadBalancer-Step2-Configuretheloadbalancer/reverseproxyserver>

I am finding the following problem with WSO2 API Manager (I am working on a WSO2 API Manager 6.2.0 version).

I published an API on the publisher portal. This API expects a POST request over HTTPS protocol and take a JSON payload as the request body.

The problem is that the published API generates a cURL request like this:

curl -k -X POST "https://MY_SERVER:8243/puntualitest/v1.0.0/puntuali" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"header\": { \"msgUid\": \"a36bea3f-6dc6-49d7-9376-XXXXXXX\", \"timestamp\": 1567060509108, \"metadata\": { \"TRACKER_BIZID_REV_CODICE\": \"7175\", \"TRACKER_BIZID_REV_NUMERO\": \"545/2019\" }, \"codApplication\": null, \"codEnte\": null, \"invocationContext\": null, \"caller\": \"SRW\", \"user\": null, \"service\": \"crediti.invioPosizioneCreditoria\" }, \"body\": { \"@dto\": \"binary\", \"content\": \"PD94bWwgdmVyc2lvbj..............+\" }}"

The problem is that, as you can see, it is trying to call the final endpoint on the 8243 port instead of on the expected 443 port that is the standard HTTPS port.

So this call ends into a Connection refused message error because the final endpoint listen on the 443 and not on the 8243.

So I have some questions:

  1. Why WSO2 API Manager try to call the final endpoint on the 8243 and not on the 443 port if the chosen protocol is HTTPS that, in theory, works on the 443?

  2. Is there a way to set the final endpoint port that has to be used is 443?

Thank you

解决方案

If you take a production case, your gateways are exposed via a load balancer and it is exposed in the port 443. From lb you can load balance to 8243 gateway servers. You can refer [1] for setting up the load balancer.

If you want, you an change the ports 8280 and 8243. For that you can change those in axis2.xml file which resides in repository/conf/axis2 location.

<transportReceiver name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpListener">
        <parameter name="port" locked="false">8280</parameter>
        <parameter name="non-blocking" locked="false">true</parameter>
        <!--parameter name="bind-address" locked="false">hostname or IP address</parameter-->
        <!--parameter name="WSDLEPRPrefix" locked="false">https://apachehost:port/somepath</parameter-->
        <parameter name="httpGetProcessor" locked="false">org.wso2.carbon.mediation.transport.handlers.PassThroughNHttpGetProcessor</parameter>
        <!--<parameter name="priorityConfigFile" locked="false">location of priority configuration file</parameter>-->
    </transportReceiver>

In the port value, you can change this to 80 and a similar definition can be found for https for the port 8243.

[1] - https://docs.wso2.com/display/AM210/Configuring+the+Proxy+Server+and+the+Load+Balancer#ConfiguringtheProxyServerandtheLoadBalancer-Step2-Configuretheloadbalancer/reverseproxyserver

这篇关于为什么 WSO2 API Manager 使用 8243 而不是 443 调用已注册 HTTPS API 的端点?我无法到达我的最终服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆