What do I do if an error is reported when I access OSS using WeChat on Android?
Issue description
When you upload a JS file to Object Storage Service (OSS), an error is reported only when you access OSS using WeChat on Android or QQ browser.
Causes
WeChat and QQ add the Content-Type:application/octet-stream header.
Solutions
-
To perform an upload test, turn on your laptop's Wi-Fi and connect your phone to it.
-
Use a packet capture tool, such as Wireshark, to inspect the traffic. The captured packets show a signature mismatch error. This error occurs because the software development kit (SDK) does not include the
Content-Type:application/octet-streamheader when it calculates the signature. However, the browser adds this header when it sends the request. This header must be included in the signature calculation. -
After tests, no error is reported when you upload an object after you delete the header. Therefore, the error is reported when the
Content-Type:application/octet-streamheader is added to WeChat or QQ browser. -
Delete the header on WeChat.