Why I got 503 Error with HTTP Post when data available, but when no data, HTTP Post requests went though

  • Thread starter Thread starter zydjohn
  • Start date Start date
Z

zydjohn

Guest
Hello:
I have a rather strange issue. I have a C# .Net Core program, I can login to a trading web site, and get some csrf tokens, then with those csrf tokens, I should be able to HTTP post some data to a specific web page.
Ie. HTTPS POST https://myweb.com/markets/page=1
It is actually an order placing web site, just like buy/sell stocks.
When I see there are some offers available via a web browser, then I want to place an order by HTTP Post using the token and application/x-www-form-urlencoded form data, something like this:
csrftoken=XYZ&side=0&price=1.10&market=123&runner=456&type=1&price_formatted=1.10&amount=1.00
Whenever I see there are some offers available via web browser, I got 503 Service Temporary Unavailable error.
But whenever there is no offers available via web browser, the HTTP Post request went through, but I got the following Json reply:
{
"canceled": true,
"matching_id": false,
"amount": 0
}
I sent the HTTP Post data by a Rest Client Insomnia 6.6.2, so I can see the server reply and save the reply in the HTTP session.

The following is Timeline records from Insomnia Version 6.6.2 for my HTTP Post Request:
* Preparing request to https://myweb.com/market/betslip/
* Using libcurl/7.57.0-DEV OpenSSL/1.0.2o zlib/1.2.11 libssh2/1.7.0_DEV
* Current time is 2019-09-08T15:30:13.610Z
* Disable timeout
* Enable automatic URL encoding
* Enable SSL validation
* Enable cookie sending with jar of 14 cookies
* Found bundle for host fairlay.com: 0x1fba9df0620 [can pipeline]
* Re-using existing connection! (#0) with host fairlay.com
* Connected to fairlay.com (104.28.26.236) port 443 (#0)

> POST /market/betslip/ HTTP/1.1
> Host: fairlay.com
> Accept: text/html,application/xhtml,*/*
> Body: text
> Content-Type: application/x-www-form-urlencoded
> Accept-Encoding: gzip, deflate
> Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
> authority: fairlay.com
> origin: Ree MyWeb
> Referer: https://myweb.com/markets/live/?sort=close_date
> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3835.0 Safari/537.36
> X-Requested-With: XMLHttpRequest
> Cookie: csrftoken=YSJYVItqYjKsAPaekHOCLIBD5mabAw2v8G4Bw7SJcpLNqhJJvoxDN5GUar6Ob9pO; _gid=GA1.2.1876159809.1567948880; _fbp=fb.1.1567948879900.1716178483; _gat_UA-41965734-1=1; sessionid=n6rp26vlgys2onzycwrhv4yvx1ovfx9t; _ga=GA1.2.539566304.1567948880; __cfduid=da870fff4f0fbff353bb3e6e838082b001567948878; _hjIncludedInSample=1
> x-csrf-token: nxogvGr5pcPO7mgSUkmV1hr2hSa3HjmaxlJT65QoDiQ9XOPn515W3EwjmX6GiWJt
> Content-Length: 174
csrftoken=nxogvGr5pcPO7mgSUkmV1hr2hSa3HjmaxlJT65QoDiQ9XOPn515W3EwjmX6GiWJt&side=0&price=2.01&market=20679428&runner=43888464&type=2&price_formatted=2.01&amount=1.00
* upload completely sent off: 174 out of 174 bytes
< HTTP/1.1 200 OK
< Date: Sun, 08 Sep 2019 15:30:13 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< X-Frame-Options: SAMEORIGIN
< Vary: Cookie

* cookie size: name/val 9 + 32 bytes
* cookie size: name/val 7 + 29 bytes
* cookie size: name/val 8 + 0 bytes
* cookie size: name/val 7 + 7 bytes
* cookie size: name/val 4 + 1 bytes
* cookie size: name/val 8 + 3 bytes

< Set-Cookie: sessionid=n6rp26vlgys2onzycwrhv4yvx1ovfx9t; expires=Sun, 22 Sep 2019 15:30:13 GMT; HttpOnly; Max-Age=1209600; Path=/; SameSite=Lax
< Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< Server: cloudflare
< CF-RAY: 5131f65f3823cc42-ZRH
< Content-Encoding: gzip

The returned Json reply is like this:
{
"canceled": true,
"matching_id": false,
"amount": 0
}

I want to know in this case, is my HTTP Post request is correct in format or not, but why when there are some offers available, I can never send HTTP Post request due to 503 error, but only when there is no offers available, my HTTP Post requests went through, yet got canceled reply.
Thanks,

Continue reading...
 
Back
Top