-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vod: specify content-length when creating presigned urls #1921
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
6732165
to
1984ac9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if (!res.headersSent) { | ||
res.status(403); | ||
res.end(); | ||
proxyRes.end(); | ||
} else { | ||
res.end(); | ||
proxyRes.end(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!res.headersSent) { | |
res.status(403); | |
res.end(); | |
proxyRes.end(); | |
} else { | |
res.end(); | |
proxyRes.end(); | |
} | |
if (!res.headersSent) { | |
res.status(403); | |
} | |
res.end(); | |
proxyRes.end(); |
proxy.on("error", function (err, req, proxyRes) { | ||
console.error("Proxy error:", err); | ||
if (!res.headersSent) { | ||
res.status(403); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this work?
res.status(403); | |
res.status(proxyRes.status); |
Bucket: config.bucket, | ||
Key: objectKey, | ||
}); | ||
ContentLength: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be just ContentLength: contentLength || null
contentLength: | ||
type: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in api-schema
since its public
What does this pull request do? Explain your changes. (required)
This is coming out of nothing, just a thing that came to my mind.
With this, we allow developers to specify a
contentLength
parameter in therequest-upload
api that generates presigned URLs.This way, that URL is going to be valid exclusively for files with that exact size in bytes.
This enables tier enforcing for platforms, for example, a platform providing free tier functionalities with a max asset size of 50MB for users would generate the presigned URL in the backend collecting the content-length of the user file and providing it to our function.
If the user tries to upload a different file, a 403 status code would get returned.
Specific updates (required)
How did you test each of these updates (required)
Does this pull request close any open issues?
Screenshots (optional)
Checklist