2016-12-12 15 views
0

私はWSO2 APIマネージャ2.0を使用しており、次の設定をaxis2.xmlとsynapse.xmlに追加してプロキシを使用するように設定しました。しかし、私が作成したテストAPIにアクセスしようとすると、「Proxy Authorization required」または「Server Hangup」というエラーが発生します。私は、ワイヤを通じて行われたリクエストを見てみると、Proxy Authenticationヘッダーを持つGETリクエスト(Server Hangupエラーを受け取る)とCONNECTリクエスト(Proxy Authorization requiredを受け取るリクエスト)エラー)はありません。なぜこのようなことが起こっているのですか?リクエストごとにヘッダーを表示するにはどうすればよいですか?WSO2 APIマネージャでプロキシ認証にエラーが発生しました

axis2.xmlを:

<transportSender name="http" class="org.apache.synapse.transport.passthru.PassThroughHttpSender"> 
    <parameter name="non-blocking" locked="false">true</parameter> 
    <parameter name="http.proxyHost" locked="false">10.1.0.236</parameter> 
    <parameter name="http.proxyPort" locked="false">80</parameter> 
</transportSender> 

<transportSender name="https" class="org.apache.synapse.transport.passthru.PassThroughHttpSSLSender"> 
    <parameter name="non-blocking" locked="false">true</parameter> 
    <parameter name="http.proxyHost" locked="false">10.1.0.236</parameter> 
    <parameter name="http.proxyPort" locked="false">80</parameter> 
    <parameter name="keystore" locked="false"> 
     <KeyStore> 
      <Location>repository/resources/security/wso2carbon.jks</Location> 
      <Type>JKS</Type> 
      <Password>wso2carbon</Password> 
      <KeyPassword>wso2carbon</KeyPassword> 
     </KeyStore> 
    </parameter> 
    <parameter name="truststore" locked="false"> 
     <TrustStore> 
      <Location>repository/resources/security/client-truststore.jks</Location> 
      <Type>JKS</Type> 
      <Password>wso2carbon</Password> 
     </TrustStore> 
    </parameter> 
    <parameter name="HostnameVerifier">AllowAll</parameter> 
     <!--supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified --> 
</transportSender> 

synapse.xml:

<definitions xmlns="http://ws.apache.org/ns/synapse"> 
    <sequence xmlns="http://ws.apache.org/ns/synapse" name="WSO2AM--Ext--In"> 
     <property name="Proxy-Authorization" expression="fn:concat('Basic ', base64Encode('smsapp:let$c0nnect'))" scope="transport"/> 
     <property name="POST_TO_URI" value="true" scope="axis2"/> 
     <property name="DISABLE_CHUNKING" value="true" scope="axis2"/> 
     <log level="custom"> 
      <property name="TRACE" value="Global Mediation Extension2"/> 
     </log> 
    </sequence> 
<!-- You can add any flat sequences, endpoints, etc.. to this synapse.xml file if you do 
*not* want to keep the artifacts in several files --> 
</definitions> 

要求とその応答:

をGET
GET https://apiurl.com/api/apiname HTTP/1.1\r\n 
    [Expert Info (Chat/Sequence): GET https://apiurl.com/api/apiname HTTP/1.1\r\n] 
     [GET https://apiurl.com/api/apiname HTTP/1.1\r\n] 
     [Severity level: Chat] 
     [Group: Sequence] 
    Request Method: GET 
    Request URI: https://apiurl.com/api/apiname 
    Request Version: HTTP/1.1 
Proxy-Authorization: Basic XXXXXXXXXXXXXXXX\r\n 
    Credentials: username:pwd 


Hypertext Transfer Protocol 
HTTP/1.1 502 Server Hangup\r\n 
    [Expert Info (Chat/Sequence): HTTP/1.1 502 Server Hangup\r\n] 
     [HTTP/1.1 502 Server Hangup\r\n] 
     [Severity level: Chat] 
     [Group: Sequence] 
    Request Version: HTTP/1.1 
    Status Code: 502 
    Response Phrase: Server Hangup 
Date: Thu, 08 Dec 2016 12:12:20 GMT\r\n 
Connection: close\r\n 
Via: HTTPS/1.1 localhost.localdomain\r\n 
Cache-Control: no-store\r\n 
Content-Type: text/html\r\n 
Content-Language: en\r\n 
Content-Length: 666\r\n 
\r\n 
[HTTP response 1/1] 
[Time since request: 0.235017000 seconds] 
[Request in frame: 456] 
File Data: 666 bytes 

CONNECT

Hypertext Transfer Protocol 
    CONNECT apiurl.com:443 HTTP/1.1\r\n 
     [Expert Info (Chat/Sequence): CONNECT apiurl.com:443 HTTP/1.1\r\n] 
      [CONNECT apiurl.com:443 HTTP/1.1\r\n] 
      [Severity level: Chat] 
      [Group: Sequence] 
     Request Method: CONNECT 
     Request URI: apiurl.com:443 
     Request Version: HTTP/1.1 
    Host: apiurl.com:443\r\n 
    Proxy-Connection: Keep-Alive\r\n 
    \r\n 
    [Full request URI: apiurl.com:443] 
    [HTTP request 1/2] 
    [Response in frame: 595] 
    [Next request in frame: 880] 


Hypertext Transfer Protocol 
    HTTP/1.1 407 Proxy Authorization Required\r\n 
     [Expert Info (Chat/Sequence): HTTP/1.1 407 Proxy Authorization Required\r\n] 
      [HTTP/1.1 407 Proxy Authorization Required\r\n] 
      [Severity level: Chat] 
      [Group: Sequence] 
     Request Version: HTTP/1.1 
     Status Code: 407 
     Response Phrase: Proxy Authorization Required 
    Date: Thu, 08 Dec 2016 12:12:22 GMT\r\n 
    Proxy-Connection: keep-alive\r\n 
    Via: 1.1 localhost.localdomain\r\n 
    Cache-Control: no-store\r\n 
    Content-Type: text/html\r\n 
    Content-Language: en\r\n 
    Proxy-Authenticate: Basic realm="Websense Content Gateway"\r\n 
    Content-Length: 666\r\n 
    \r\n 
    [HTTP response 1/2] 
    [Time since request: 0.002752000 seconds] 
    [Request in frame: 589] 
    [Next request in frame: 880] 
    [Next response in frame: 894] 
    File Data: 666 bytes 

答えて

0

ここで(私はESBの5.0.0ではなく、API Managerを使用)私のために働いたソリューションです。

私の場合、proxyProfilesを HTTPに追加し、 HTTPS送信者を軸2に追加する必要がありました。だから私はしなければならなかった:

  1. 削除プロキシパラメータhttpと httpsの送信者:

    <parameter name="http.proxyHost" locked="false">some_host</parameter> 
    <parameter name="http.proxyPort" locked="false">some_port</parameter> 
    
  2. <parameter name="proxyProfiles"> 
         <profile> 
          <targetHosts>*</targetHosts> 
          <proxyHost>some_host</proxyHost> 
          <proxyPort>some_port</proxyPort> 
          <proxyUserName>some_username</proxyUserName> 
          <proxyPassword>some_password</proxyPassword> 
         </profile> 
    </parameter> 
    
    両方のhttpと httpsの送信者に)パラメータProxyProfilesを追加します。
  3. 私の.xml API Proxy-AuthorizationPOST_TO_URIを削除しました。

詳細: Working with Proxy Servers (wso2.com)

編集:いくつかのより多くのテストの後 はHTTPがAPIでProxy-AuthorizationPOST_TO_URIパラメータを必要としているようですが、HTTPSではなく、それらの私は前に述べたようにproxyProfilesを必要とします。これがなければ、HTTPSサービスを呼び出すことは不可能です。

関連する問題