This topic describes FAQ about message pushing.
1. What can I do if an HTTP endpoint fails to receive a message? How do I debug the HTTP endpoint?
- We recommend that you use On-premises debug tool of HTTP endpoints to check whether the message receiving logic of an HTTP endpoint is valid. You can use the debugging tool to verify the authentication logic and message processing logic of the HTTP endpoint.
- If a verified HTTP endpoint fails to receive online messages, we recommend that you use the Log management feature to retrieve operations logs of messages and check the processes and results of message pushing. If you cannot troubleshoot issues based on operations logs, submit a ticket.
2. How can I verify whether the signing certificate URL that is specified in the x-mns-signing-cert-url request header is provided by MNS?
- To confirm that a request is sent from MNS, you must verify the signature certificate URL.
- Currently, MNS stores the public key certificate in the mnstest Object Storage Service
(OSS) bucket. The URL of the certificate:
https://mnstest.oss-cn-hangzhou.aliyuncs.com/x509_public_certificate.pem. To ensure high security, the certificate is regularly updated and the file name changes. However, the file remains in the mnstest bucket. You can check the prefix to verify the certificate URL. If the prefix is
https://mnstest.oss-cn-hangzhou.aliyuncs.com/, the certificate URL is valid.
- We may consider changing the storage location of the certificate to ensure data security. If the storage location changes, we will notify you of the update.
3. Remote requests to retrieve the public key certificate during HTTP endpoint authentication take long time to be processed. How can I improve the performance?
- We recommend that you use a key-value pair to cache the public key certificate and the certificate URL so that you can retrieve the certificate from the memory. Each message pushing request of MNS contains the URL of the public key certificate. If the certificate is updated, the certificate URL changes. For example, a version number is added to the certificate file name. If the certificate URL does not change, the cached certificate remains effective. When processing a message pushing request, you can use the URL in the x-mns-signing-cert-url header to retrieve the certificate from the memory. If you fail to retrieve the certificate from the memory, you can send a remote request to retrieve the certificate and cache the certificate for future use.
- For example, if the certificate URL is
https://mnstest.oss-cn-hangzhou.aliyuncs.com/x509_public_certificate.pem, you can use the following key-value pair to cache the certificate:
typedef map<string, string> cache; cache["x509_public_certificate.pem"] = "$content"; cache["x509_public_certificate.pem.version2"] = "$content2";
4. What can I do if the request signature fails to be verified?
5. What can I do if the endpoint fails to receive messages and the messages are not recorded in the operations logs after I create a subscription?
Check whether you specified the FilterTag parameter.
If you specify the FilterTag parameter when creating the subscription, you must also specify the MessageTag parameter when calling the PublishMessage operation. Otherwise, messages are filtered and are not pushed. In this case, the messages are not recorded in the operations logs.
6. What can I do if the HTTP endpoint fails to receive messages when I use the PHP programming language to call the HttpEndpoint operation?
Check whether you use the $_POST['fieldname'] method to retrieve the data that is contained in the request body. To retrieve the data, you must use the following method:
The $_POST['fieldname'] method only supports the following content type: application/x-www-form-urlencoded. However, message pushing requests of MNS only support the following three content types:
text/xml;charset=utf-8 text/plain;charset=utf-8 application/json;charset=utf-8
The file_get_contents("php: // input") method allows you to retrieve the original data that is sent by using the POST method. You do not need to specify the content type. Therefore, we recommend that you use the file_get_contents("php: // input") method to process message push requests.