[英]WSO2 in Hybrid gateway environment always routing to Sandbox URL, even when used with production access token
I am using WSO2 APIM 3.0.0 version & I have published an API in WSO2 using an existing swagger definition.我正在使用 WSO2 APIM 3.0.0 版本,并且我已经使用现有的 swagger 定义在 WSO2 中发布了一个 API。
I am using a hybrid gateway environment, with the "Production" & "Sandbox" URLs configured to different code environments (for testing purposes the "Production" URL hits our qa box and "Sandbox" hits my local environment).我正在使用混合网关环境,将“生产”和“沙箱”URL 配置为不同的代码环境(出于测试目的,“生产”URL 命中我们的 qa 框,“沙箱”命中我的本地环境)。 I have just noticed that WSO2 is always routing calls to the sandbox environment (my local) even when I use the "Production" access token.我刚刚注意到,即使我使用“生产”访问令牌,WSO2 也始终将调用路由到沙箱环境(我的本地)。
Is there something else I need to do apart from simply generating different access tokens for prod & sandbox from the devportal for it to route to the desired environment?除了简单地从 devportal 为 prod 和沙箱生成不同的访问令牌以路由到所需的环境之外,我还有什么需要做的吗?
And does this mean that I MUST always have different gateways for different environments?这是否意味着我必须始终为不同的环境使用不同的网关?
I tested this using OAUTH & JWT token types, with different grant mechanisms, and it still does the same thing.我使用 OAUTH 和 JWT 令牌类型进行了测试,使用不同的授权机制,它仍然做同样的事情。
synapse-config attached as requested:根据要求附加突触配置:
<?xml version="1.0" encoding="UTF-8"?><api xmlns="http://ws.apache.org/ns/synapse" name="admin--XXXBackendPlatform" context="/WSO2/1.0.0" version="1.0.0" version-type="context">
<resource methods="POST" url-mapping="xxxxx" faultSequence="fault">
<inSequence>
<property name="api.ut.backendRequestTime" expression="get-property('SYSTEM_TIME')"/>
<filter source="$ctx:AM_KEY_TYPE" regex="SANDBOX">
<then>
<send>
<endpoint key="XXXBackendPlatform--v1.0.0_APIsandboxEndpoint"/>
</send>
</then>
<else>
<sequence key="_production_key_error_"/>
</else>
</filter>
</inSequence>
<outSequence>
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
<send/>
</outSequence>
</resource>
<handlers>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler">
<property name="apiUUID" value="6535a4b7-759b-4f0e-8980-eab80aaee847"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.CORSRequestHandler">
<property name="apiImplementationType" value="ENDPOINT"/>
<property name="AuthorizationHeader" value="WSO2_Auth"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.APIAuthenticationHandler">
<property name="RemoveOAuthHeadersFromOutMessage" value="true"/>
<property name="APILevelPolicy" value="Unlimited"/>
<property name="AuthorizationHeader" value="WSO2_Auth"/>
<property name="CertificateInformation" value="{}"/>
<property name="APISecurity" value="oauth2,oauth_basic_auth_api_key_mandatory"/>
<property name="apiUUID" value="6535a4b7-759b-4f0e-8980-eab80aaee847"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.throttling.ThrottleHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtUsageHandler"/>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtGoogleAnalyticsTrackingHandler">
<property name="configKey" value="gov:/apimgt/statistics/ga-config.xml"/>
</handler>
<handler class="org.wso2.carbon.apimgt.gateway.handlers.ext.APIManagerExtensionHandler"/>
</handlers>
</api>
As per the below part, you have only configured a sandbox endpoint in your API.根据以下部分,您仅在 API 中配置了沙箱端点。 You should get an error if you use production keys to access the API.如果您使用生产密钥访问 API,您应该会收到错误消息。
<filter source="$ctx:AM_KEY_TYPE" regex="SANDBOX">
<then>
<send>
<endpoint key="XXXBackendPlatform--v1.0.0_APIsandboxEndpoint"/>
</send>
</then>
<else>
<sequence key="_production_key_error_"/>
</else>
</filter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.