Skip to content

Commit 6ba1abe

Browse files
authored
Apply suggestions from code review
1 parent f48a8af commit 6ba1abe

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/content/docs/r2/api/s3/presigned-urls.mdx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Generate a presigned URL by referring to the following examples:
7676

7777
### Example of generating presigned URLs
7878

79-
A possible use case may be restricting an application to only be able to upload to a specific URL. With presigned URLs, your central signing application might look like the following JavaScript code running on Cloudflare Workers, workerd, or another platform (you might have to update the code based on the platform you are using).
79+
A possible use case may be restricting an application to only be able to upload to a specific URL. With presigned URLs, your central signing application might look like the following JavaScript code running on Cloudflare Workers, `workerd`, or another platform (you might have to update the code based on the platform you are using).
8080

8181
If the application received a request for `https://example.com/uploads/dog.png`, it would respond with a presigned URL allowing a user to upload to your R2 bucket at the `/uploads/dog.png` path.
8282

@@ -140,11 +140,16 @@ export default {
140140

141141
## Differences between presigned URLs and R2 binding
142142

143-
When using the R2 binding, you will not need any token secrets in your Worker code. Instead, in your [Wrangler configuration file](/workers/wrangler/configuration/), you will create a [binding](/r2/api/workers/workers-api-usage/#3-bind-your-bucket-to-a-worker) to your R2 bucket. Additionally, authorization is handled in-line which can reduce latency.
143+
- When using an R2 binding, you will not need any token secrets in your Worker code. Instead, in your [Wrangler configuration file](/workers/wrangler/configuration/), you will create a [binding](/r2/api/workers/workers-api-usage/#3-bind-your-bucket-to-a-worker) to your R2 bucket. Additionally, authorization is handled in-line, which can reduce latency.
144144

145-
However, when using presigned URLs, you will need to create and use the token secrets in your Worker code.
145+
- When using presigned URLs, you will need to create and use the token secrets in your Worker code.
146146

147-
In some cases, Workers lets you implement certain functionality more easily. For example, if you wanted to offer a write-once guarantee so that users can only upload to a path once, with pre-signed URLs, you would need to sign specific headers and require the sender to send the same headers. You can modify the previous example to sign additional headers:
147+
In some cases, R2 bindings let you implement certain functionality more easily. For example, if you wanted to offer a write-once guarantee so that users can only upload to a path once, with pre-signed URLs:
148+
149+
- With R2 binding: You only need to pass the parameter once.
150+
- With presigned URLs: You need to sign specific headers and require the sender to send the same headers.
151+
152+
You can modify the previous example to sign additional headers:
148153

149154
```ts
150155
const signed = await client.sign(

0 commit comments

Comments
 (0)