Upload data to DO Spaces using a TCP connection

March 26, 2019 776 views
Storage API DigitalOcean

I was hoping to find out there was any way to upload data to DigitalOcean Spaces using a TCP connection. I am currently getting a 302 Found error when I attempt to connect to my Spaces using a TCP connection.

3 Answers

Greetings!

TCP traffic should be fine. The 302 code is a redirect. I suspect you may be connecting over http rather than https. Make sure the URL you’re connecting to is https. If that is the case and you’re still seeing this, let us know the full error you’re getting from your application, as well as more information about what you are using to connect, and we may have more insight.

Jarland

Thank you. We are using https. We have been able to connect using TCP but we get the 302 code error when we try to upload a data file. Should we still be using the AWS3 protocols when attempting to upload data using TCP? Is there a way to check data logs for Spaces? Perhaps those logs have some additional details on what we are doing wrong.

  • The 302 code isn’t so much an error but is actually an http redirect. It’s interesting that you’re seeing this with the https call. We are mostly compatible with S3 protocol, but not fully 1:1 compatible (just mostly). You can read more about that here:

    https://developers.digitalocean.com/documentation/spaces/

    I tried to look up some information on espressif but didn’t get far as to how that correlates. If you can provide more about the function/call or the full underlying request being made to our API from it, that may open up more insight.

    • When we run the following code through Postman

      PUT /example2.txt HTTP/1.1
      Host: SPACESID.sfo2.digitaloceanspaces.com
      Content-Type: text/plain
      Host: SPACES
      ID.sfo2.digitaloceanspaces.com
      Content-Length: 4
      X-Amz-Content-Sha256: 532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25
      X-Amz-Date: 20190326T160421Z
      Authorization: AWS4-HMAC-SHA256 Credential=QS72ZMDN3AHYNA4KU2SP/20190326/sfo2/s3/aws4_request, SignedHeaders=cache-control;content-length;content-type;host;postman-token;x-amz-content-sha256;x-amz-date, Signature=6eb179f72d36fda73f812009d5868b25e4dfa884c57ffb86f04ba29afa148edf
      cache-control: no-cache
      Postman-Token: 4d1eb481-dcc1-4879-9a46-e02015867577

      We get the following error back after 2 minutes or so when we use the following http request:

      AT< +IPD,0,276:HTTP/1.1 403 Forbidden
      AT< Content-Length: 188
      AT< x-amz-request-id: tx000000000000072d65f26-005c9a4e0c-795ea-sfo2a
      AT< Accept-Ranges: bytes
      AT< Content-Type: application/xml
      AT< Date: Tue, 26 Mar 2019 16:06:36 GMT
      AT< Strict-Transport-Security: max-age=15552000; includeSubDomains; preload

      • Interesting. I assume the SPACES_ID is a replacement for privacy, given the public space. It might be a good idea to run this by our support team so that they can pass back to you their findings from logs on our side, just to make sure this is covered. Of course, anyone else in our community is welcome to weigh in if they’ve dealt with this, but I’d love for you to get the answer.

        You can open a ticket with our team here:
        https://cloudsupport.digitalocean.com/s/

        They are a bit backed up right now, but working to handle the tickets as quickly as possible.

        • That is correct regarding the SPACEID. Thank you for your assistance. I will reach out to support at the link you provided.

In case it is helpful, we are trying to upload data files using Espressif

Have another answer? Share your knowledge.