This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
INACTIVE - AWS lambda CORS proxy
License
MozillaReality/drummon
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a failed experiment to attempt generalized CORS proxying of arbitrary URLs via AWS lambda. You can use this for CORS proxying a simple API as-is, but longer responses (such as binary blobs) will fail due to memory/response size limitations of lambda. The API is the same as cors-anywhere. The main reasons: - To return binary data from a lambda, you need to pipe it through Base64 encoding, which is cumbersome and slow - Because lambda requires a JSON response, there's no method to stream the body, which is problematic for large responses since the entire response needs to be buffered into memory before being returned. The implementation found here does try to minimize memory usage by streaming the body out inline, but it seems that the caller ends up buffering it into a JSON blob and hence the high watermark on memory use for the lambda is proportional to the response size. - Lambda has a hard response size limit of a few megs, and the API Gateway imposes a timeout of 30s. Both of these are prohibitive to a general web proxy. For a nicer solution to this problem, there's a Cloudflare worker we've developed: https://github.com/mozilla/hubs-ops/blob/master/workers/cors-proxy.js
About
INACTIVE - AWS lambda CORS proxy
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published