Simple large file uploads via presigned S3 URLs - #210
Merged
Merged
Conversation
…TTP client The `XSRF-TOKEN` cookie is read first (like axios and Inertia do), the `<meta name="csrf-token">` tag is the fallback, and the token is only sent automatically for same-origin requests. The new `httpClient` option accepts an axios-compatible client, like `Vapor.store()`, so that Vapor users can keep their configured axios instance. Claude-Session: https://claude.ai/code/session_013xfi415r8t7YxVptPkiJU4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lambda limits request bodies to about 6 MB (roughly 4 MB of file once base64-encoded), so large files cannot go through the application.
This PR adds a helper to simplify S3 uploads: the browser asks the app for a presigned S3 URL, uploads the file straight to S3 under a temporary prefix, then sends the S3 key to the app, which validates it and moves the file to its final location.
Usage
The bucket needs a lifecycle rule expiring
tmp/and a CORS rule allowingPUTfrom the app's origin. The Bref docs are updated in a separate PR.Documentation: brefphp/bref#2181