简体   繁体   中英

WSO2 API Manager 1.10 issue

We are running into an issue where a call to a WSO2 API REST endpoint fails with a "412 Precondition Failed" when the Content-Length exceeds 1068. Just adding a space to the request (increasing size to 1069) causes this failure. This issue can also happen when content length is less than 1069, if the API is called fast enough (using SOAPUI for testing). We have a theory that the header and body are split between packets and confuses the request. We tried turning off chunking and that didn't affect things. When the back end REST service is called directly it works fine.

You can turn off the chunking as below by using the property mediator if you are calling the SOAP endpoint. But you have to make sure that the SOAP endpoint is also expecting a non-chunked request.

<property name=”DISABLE_CHUNKING” value=”true” scope=”axis2″/>


But if you are using REST endpoint above property may not work sometimes. In that kind of situation, we need to make sure the Content-Length header is appended to the request. We can use below two properties to append the Content-Length header.

<property name="FORCE_HTTP_CONTENT_LENGTH" value="true" scope="axis2"></property>
<property name="COPY_CONTENT_LENGTH_FROM_INCOMING" value="true" scope="axis2"></property>

Sample proxy inSequence

     <inSequence>
         <log level="custom">
            <property name="msg" value="Executing IN sequence"></property>
         </log>
         <property name="FORCE_HTTP_CONTENT_LENGTH" value="true" scope="axis2"></property>
         <property name="COPY_CONTENT_LENGTH_FROM_INCOMING" value="true" scope="axis2"></property>
         <send>
            <endpoint>
               <address uri="https://www.google.com" format="rest"></address>
            </endpoint>
         </send>
      </inSequence>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM