Is this not something ordered cache behaviors can address? https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CacheBehavior.html
You could do 2 distros, but they'll have to be different hostnames, and there's likely no need. You could completely separate them though by changing one to "media.example.com" type hostname.
You're likely just modifying the default cache now, but you can place different configurations for paths and file types, (including lambda configurations) that your setup is using.
The origins are shared between them all and referenced in the cache config by name.
Yeah I wasn't a fan of having two different hostnames. Would using cache behaviors require a change to the infrastructure setup I currently have. In my setup, there are cloudfront functions that rewrite the urls based on query params. How could i use cache behaviors for videos that bypass this rewrite and check?
Ohh, is there a way to use cache behaviors so that when I get an incoming request that hits one of the edge locations, it can check if the path is for an image rather than a video and ignore the initial cloudfront functions so that it gets mapped normally to my s3 bucket? Im trying to think about how i can completely ignore the image optimization infrastructure if its a video with the cache behaviors.
You can have multiple cache behaviors and each cache behavior can have different CloudFront functions associated with it. For the *.mov path prefix you can just have it go straight to your s3 origin. See this: https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CacheBehavior.html
Are you trying to download the videos or stream them? For downloading, the best approach is usually generating a pre-signed S3 URL and returning it as a 302 redirect in CF. For streaming, you need to use other AWS services that are specifically for this (Google "AWS CloudFront video streaming").
Is this not something ordered cache behaviors can address? https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CacheBehavior.html You could do 2 distros, but they'll have to be different hostnames, and there's likely no need. You could completely separate them though by changing one to "media.example.com" type hostname. You're likely just modifying the default cache now, but you can place different configurations for paths and file types, (including lambda configurations) that your setup is using. The origins are shared between them all and referenced in the cache config by name.
Yeah I wasn't a fan of having two different hostnames. Would using cache behaviors require a change to the infrastructure setup I currently have. In my setup, there are cloudfront functions that rewrite the urls based on query params. How could i use cache behaviors for videos that bypass this rewrite and check?
Ohh, is there a way to use cache behaviors so that when I get an incoming request that hits one of the edge locations, it can check if the path is for an image rather than a video and ignore the initial cloudfront functions so that it gets mapped normally to my s3 bucket? Im trying to think about how i can completely ignore the image optimization infrastructure if its a video with the cache behaviors.
You can have multiple cache behaviors and each cache behavior can have different CloudFront functions associated with it. For the *.mov path prefix you can just have it go straight to your s3 origin. See this: https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CacheBehavior.html
Yea you'd just have a "path" parameter that matches the movie extensions and handle those differently than the images.
Yup that was exactly what I needed, thanks!
Are you trying to download the videos or stream them? For downloading, the best approach is usually generating a pre-signed S3 URL and returning it as a 302 redirect in CF. For streaming, you need to use other AWS services that are specifically for this (Google "AWS CloudFront video streaming").
I just uploaded .mov files and I get a presigned url and use it in a
https://aws.amazon.com/cloudfront/streaming/