为什么 WSO2 API 经理商店有 2 url 显示在 UI

why does the WSO2 API Manager store have 2 url displayed on UI

我们已经部署了 WSO2 API 管理器的一体化实例。我们已经让 ssl 正常工作,您可以登录并查看已发布的 APIs。

我们已将 carbon.xml 设置为具有面向外部的地址 (apidev.example.com),并且可以从该地址访问 /store/ 和 /publisher/。

但是,问题是商店中发布的 API 使用的是 dev.company.interal 的本地主机名。

这意味着用户将签署

https://apidev.example.com/store

点击 API 并重定向到

https://dev.company.interal:9443/store/apis/...

这不好,因为我们网络外的人无法访问该地址。所以我希望商店使用面向外部的地址。

我已经包含了配置文件,简称为已进行的编辑。

carbon.xml

 <HostName>apidev.example.com</HostName>
 <!-- Host name to be used for the Carbon management console-->
 <MgtHostName>apidev.example.com</MgtHostName>

api-manager.xml

<APIManager>   
    <DataSourceName>jdbc/WSO2AM_DB</DataSourceName>

    <GatewayType>Synapse</GatewayType>

    <EnableSecureVault>false</EnableSecureVault>   
    <AuthManager>
        <!-- Server URL of the Authentication service -->
            <ServerURL>https://dev.company.interal:${mgt.transport.https.port}${carbon.context}services/</ServerURL>
        <!-- Admin username for the Authentication manager. -->
        <Username>${admin.username}</Username>
        <!-- Admin password for the Authentication manager. -->
        <Password>${admin.password}</Password>
        <!-- Indicates whether the permissions checking of the user (on the Publisher and Store) should be done
           via a remote service. The check will be done on the local server when false. -->
        <CheckPermissionsRemotely>false</CheckPermissionsRemotely>
    </AuthManager>
     ...
    <APIGateway>
        <!-- The environments to which an API will be published -->
        <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://apidev.example.com${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://apidev.linkedsystems.uk:${https.nio.port}</GatewayEndpoint-->
        <GatewayEndpoint>http://apidev.example.com,https://apidev.example.com</GatewayEndpoint>
            </Environment>
        </Environments>
    </APIGateway>
    ...
    <APIKeyValidator>
        <!-- Server URL of the API key manager -->
        <ServerURL>https://dev.company.interal:${mgt.transport.https.port}${carbon.context}services/</ServerURL>

        <!-- Admin username for API key manager. -->
        <Username>${admin.username}</Username>
        <!-- Admin password for API key manager. -->
        <Password>${admin.password}</Password>


        <KeyValidatorClientType>ThriftClient</KeyValidatorClientType>
        <ThriftClientConnectionTimeOut>10000</ThriftClientConnectionTimeOut>
        <!--ThriftClientPort>10397</ThriftClientPort-->

        <EnableThriftServer>true</EnableThriftServer>
        <ThriftServerHost>localhost</ThriftServerHost>
        <!--ThriftServerPort>10397</ThriftServerPort-->

        <!--ConnectionPool>
            <MaxIdle>100</MaxIdle>
            <InitIdleCapacity>50</InitIdleCapacity>
        </ConnectionPool-->
        <!-- Specifies the implementation to be used for KeyValidationHandler. Steps for validating a token can be controlled by plugging in a 
             custom KeyValidation Handler -->
        <KeyValidationHandlerClassName>org.wso2.carbon.apimgt.keymgt.handlers.DefaultKeyValidationHandler</KeyValidationHandlerClassName>
    </APIKeyValidator>
    ... 
    <!-- API Store Related Configurations -->
    <APIStore>
        <!--GroupingExtractor>org.wso2.carbon.apimgt.impl.DefaultGroupIDExtractorImpl</GroupingExtractor-->
        <!--This property is used to indicate how we do user name comparision for token generation https://wso2.org/jira/browse/APIMANAGER-2225-->
        <CompareCaseInsensitively>true</CompareCaseInsensitively>
        <DisplayURL>true</DisplayURL>
        <!--URL>https://localhost:${mgt.transport.https.port}/store</URL-->
    <URL>https://apidev.example.com/store</URL>


        <!-- Server URL of the API Store. -->
        <ServerURL>https://apidev.example.com:${mgt.transport.https.port}${carbon.context}services/</ServerURL>
        <!-- Admin username for API Store. -->
        <Username>${admin.username}</Username>

        <!-- Admin password for API Store. -->
        <Password>${admin.password}</Password>
        <!-- This parameter specifies whether to display multiple versions of same
             API or only showing the latest version of an API. -->
        <DisplayMultipleVersions>false</DisplayMultipleVersions>
        <!-- This parameter specifies whether to display all the APIs
             [which are having DEPRECATED/PUBLISHED status] or only display the APIs
             with having their status is as 'PUBLISHED' -->
        <DisplayAllAPIs>false</DisplayAllAPIs>
        <!-- Uncomment this to limit the number of APIs in api the API Store -->
        <!--APIsPerPage>5</APIsPerPage-->

        <!-- This parameter specifies whether to display the comment editing facility or not.
             Default is "true". If user wants to disable, he must set this param as "false" -->
        <DisplayComments>true</DisplayComments>

        <!-- This parameter specifies whether to display the ratings  or not.
             Default is "true". If user wants to disable, he must set this param as "false" -->
        <DisplayRatings>true</DisplayRatings>

        <!--set isStoreForumEnabled to false for disable forum in store-->
        <!--isStoreForumEnabled>false</isStoreForumEnabled-->
    </APIStore>
    ...
    <ThrottlingConfigurations>
        <EnableAdvanceThrottling>true</EnableAdvanceThrottling>
        <DataPublisher>
            <Enabled>false</Enabled>
            <Type>Binary</Type>
            <ReceiverUrlGroup>tcp://${carbon.local.ip}:${receiver.url.port}</ReceiverUrlGroup>
            <AuthUrlGroup>ssl://${carbon.local.ip}:${auth.url.port}</AuthUrlGroup>
            <Username>${admin.username}</Username>
            <Password>${admin.password}</Password>
            <DataPublisherPool>
                <MaxIdle>1000</MaxIdle>
                <InitIdleCapacity>200</InitIdleCapacity>
            </DataPublisherPool>
            <DataPublisherThreadPool>
                <CorePoolSize>200</CorePoolSize>
                <MaxmimumPoolSize>1000</MaxmimumPoolSize>
                <KeepAliveTime>200</KeepAliveTime>
            </DataPublisherThreadPool>
        </DataPublisher>
        <PolicyDeployer>
            <ServiceURL>https://dev.company.interal:${mgt.transport.https.port}${carbon.context}services/</ServiceURL>
            <Username>${admin.username}</Username>
            <Password>${admin.password}</Password>
        </PolicyDeployer>
        <BlockCondition>
            <Enabled>true</Enabled>
            <!--InitDelay>300000</InitDelay>
            <Period>3600000</Period-->
        </BlockCondition>
        <JMSConnectionDetails>
            <Enabled>true</Enabled>
            <ServiceURL>tcp://${carbon.local.ip}:${jms.port}</ServiceURL>
            <Username>${admin.username}</Username>
            <Password>${admin.password}</Password>
            <Destination>throttleData</Destination>
            <!--InitDelay>300000</InitDelay-->
            <JMSConnectionParameters>
                ...
</APIManager>

任何 help/pointers 将不胜感激

所以答案是;

文件位于 {AM_HOME}/repository/deployment/server/jaggeryapps/store/site/conf/site.json

需要更改以反映反向代理设置。按照问题中列出的示例,新设置将是;

"reverseProxy" : {
    "enabled" : true,    // values true , false , "auto" - will look for  X-Forwarded-* headers
    "host" : "apidev.example.com", // If reverse proxy do not have a domain name use IP
    "context":"/store",
  //"regContext":"" // Use only if different path is used for registry
},

这就是所有人