lpares12
CDCloudflare Developers
•Created by lpares12 on 10/3/2024 in #general-help
PUT object with presigned URL sets the incorrect Type in R2 object
Okay, this seems like a limitation of R2: https://github.com/boto/boto3/issues/934
Since R2 does not allow POST for uploading objects to the bucket, so there's no way around it. In any case, R2 should read the content-type of the request I'm making I believe.
3 replies
CDCloudflare Developers
•Created by lpares12 on 10/3/2024 in #general-help
PUT object with presigned URL sets the incorrect Type in R2 object
Note that setting the ContentType when creating the presigned URL just makes the request return a CORS error. E.g: this does not work:
3 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
Really late (I have been working on other stuff), but I confirm that with this package it works!
I don't remember which package I used before or how I used it, so I can't really compare. And there must be something wrong in my custom function when adding the temporary token info, but In any case, I can work from this now!
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
I'm gonna try with the package later and see if I make any difference. But the same exact function I used for R2 worked fine in S3.
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
I'm using all the data that R2 sends back from the r2/temp-access-credentials api call. So I'm using all the new secret key, id and token.
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
Could I have the code you use to generate the presigned URL?
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
I have the exact same. The parent key has full control of R2, but R2 keeps replying that X-Amz-Security-Token is not allowed. Or just gives a CORS error (but I found out google chrome shows all errors as CORS errors 😅 ). I'd be great to see an example of how you are using this.
Could it be the object I'm trying to access is "inside a folder" (e.g. whatever/whatever2/object.png). Even though I have tried in the "root" of the bucket and had the same problem I believe.
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
Did you generatw the temporary credentials with the R2 endpoint? Are they for a specific bucket or for global access?
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
Could you share the code? It does not work for me. The R2 server does not accept a X-Amz-Security-Token parameter. Hence, it seems to not follow the S3 specification.
I of course, use the new Secret Key, Secret Key Id and the token
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
No news about this?
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
Hi! I couldn't manage to do it. My guess is that you can't presign URLs with a temporary token (or you can but the server won't accept it). This is possible in AWS S3 btw
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
bump
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
bump, still couldn't find a solution..
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
This is the endpoint I used to generate the credentials btw: https://developers.cloudflare.com/api/operations/r2-create-temp-access-credentials
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
And more info, when I use normal credentials (not temporary access credentials), if I add also the token, when using the presigned URL I see:
Which is expected I guess. But makes me think that the temporary access credentials have no permissions for this operation.
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
Btw, the temporary access credentials have read permissions to the resource. And I'm just trying to do a GET of the resource.
22 replies
CDCloudflare Developers
•Created by lpares12 on 7/9/2024 in #general-help
R2: Create a presigned URL with Temporary access credentials
I'm passing the accessKeyId, secretAccessKey and sessionToken. But it seems that the signature generated when containing
X-Amz-Security-Token
does not really work, since cloudlflare returns this when accessing the URL:
When I do with non-Temporary access credentials, without passing the session token, then it works. So I'm starting to wonder if the temporary credentials have no permissions to create presignedURLs?22 replies