sveltekit-adapter-lambda icon indicating copy to clipboard operation
sveltekit-adapter-lambda copied to clipboard

Using cloudfront function to route to static assets

Open aidan-gee opened this issue 2 years ago • 2 comments

Hi,

I believe it would be cheaper / faster to use a cloudfront function to route to static assets rather than Lambda@edge in some cases. It may be beneficial to have the option to choose

aidan-gee avatar Jan 18 '23 16:01 aidan-gee

I don't think the origin re-writing would is possible however, i think there may be a way around this. Watch this space!

yarbsemaj avatar Jan 18 '23 21:01 yarbsemaj

I added 2 origins to cloudfront, one goes to lambda as default behavior (not @edge), changed sveltekit's config.kit.paths.assets to ${ORIGIn}/_assets the second origin has a origin_path of /_asset/* and it routes all static assets to the secondary origin "s3", if i understand correctly this how im serving static files from s3 instead of the lambda function itself

falmar avatar May 21 '23 17:05 falmar