When setting up GCP uptime monitoring through the console with the following settings, I am getting a Request Exception in 10,000 ms
error response. The documentation mentions "encode URL yourself" on the body section, which I presume is a standard URL encode.
General
Request Method : POST
Body : %7B%20%22query%22%3A%20%22query%20%7B%20__typename%20%7D%22%20%7D
Host Header : application/x-www-form-urlencoded
Port : 443
Custom Headers
Header : Authorization
Value : Basic <hash token>
The equivalent via curl
which works would be as the following example.
curl -X POST https://api.mytest.com \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic <hash token>' \
-d '{"query": "query { __typename }" }'
The body section on explaining is cryptic as how the expected contents should be like. I am wondering if anyone did get an example of POST data working nicely with uptime?
Regarding the URL encoding, you can find how to build a valid URL to be used in GCP in this document. This kind of URL is limited to 8192 characters, and please keep in mind that when you are building an encoded URL, you must ensure that it contains only valid characters, which are mentioned in the previous document. Here you can find a tool that could help you to encode your URL.
Additionally, you could try to increase the “
Response time out” from the default 10 sec to 30 sec or more
. This is because when you use an uptime check based on a URL, the redirections at the URL take more time. Please notice that it is very important to double-check the target protocol that you chose (“http or https”). Also, you need to be sure that the URL is answering with the proper FQDN using this commandnslookup + yourdomain.com
, for example:Nslookup yourdomain.com