Generated libcurl code giving bad gateway


#1

I am trying to perform an HTTP POST request to send a .zip file to a server. When I send this request through Postman itself, it is successful. However, when I generate C++ code for it, I get a bad gateway error. I know I have libcurl successfully installed and implemented into my code, as I use it for other things, but I’m still getting this error and I can’t find any help on this issue.
My code snippet:

CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "http://warcraft2.website/api/upload/maps");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Postman-Token: d28be5aa-489a-47c4-9d26-90db7a456fb4");
headers = curl_slist_append(headers, "cache-control: no-cache");
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"map\"; filename=\"C:\\Users\\adamw\\Desktop\\appsend.zip\"\r\nContent-Type: application/zip\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--");

CURLcode ret = curl_easy_perform(hnd);

The error I’m getting when running this in my code:

502 Bad Gateway

502 Bad Gateway



nginx/1.10.3 (Ubuntu)

Any help would be greatly appreciated.