Call the 24/7 ScamShield Helpline at 1799 if you are unsure if something is a scam.
Guide to hosting and accessing static images and videos from AWS S3 with CloudFront CDN for optimal performance, scalability, and global delivery.
Your application is configured to use CloudFront CDN for static assets.
Current Configuration:
https://d1zmvuaonqb46v.cloudfront.netHSA Self Help Tools uses AWS S3 for storing static assets (images, videos) and CloudFront as a Content Delivery Network (CDN) to serve these assets globally with low latency and high performance.
Scalable, secure object storage for all static assets
Global content delivery with edge caching
Fast delivery with automatic optimization
Set the CLOUDFRONT_URL environment variable to your CloudFront distribution URL:
# .env.local (for local development)
CLOUDFRONT_URL=https://d1234567890abc.cloudfront.net
# Or use NEXT_PUBLIC_ prefix for client-side access
NEXT_PUBLIC_CLOUDFRONT_URL=https://d1234567890abc.cloudfront.netNote: Use CLOUDFRONT_URL for server-side only access (recommended for security). Use NEXT_PUBLIC_CLOUDFRONT_URL if you need client-side access.
import { CloudFrontUrlUtil } from '@/utils/cloudfrontUtils';
// Get full URL for an asset
const imageUrl = CloudFrontUrlUtil.getAssetUrl('/images/banner.jpg');
// Returns: "https://d1234567890abc.cloudfront.net/images/banner.jpg"
// Get multiple asset URLs
const urls = CloudFrontUrlUtil.getAssetUrls([
'/images/logo.png',
'/videos/intro.mp4',
'/images/hero-bg.jpg'
]);
// Check if CloudFront is configured
if (CloudFrontUrlUtil.isConfigured()) {
console.log('CDN is ready');
}import Image from 'next/image';
import { CloudFrontUrlUtil } from '@/utils/cloudfrontUtils';
export default function MyComponent() {
const imagePath = '/images/product-photo.jpg';
const imageUrl = CloudFrontUrlUtil.getAssetUrl(imagePath);
return (
<Image
src={imageUrl}
alt="Product Photo"
width={800}
height={600}
priority
/>
);
}import { CloudFrontUrlUtil } from '@/utils/cloudfrontUtils';
export default function VideoPlayer() {
const videoUrl = CloudFrontUrlUtil.getAssetUrl('/videos/tutorial.mp4');
return (
<video
src={videoUrl}
controls
className="w-full rounded-lg"
>
Your browser does not support the video tag.
</video>
);
}import { CloudFrontUrlUtil } from '@/utils/cloudfrontUtils';
export default function HeroSection() {
const bgUrl = CloudFrontUrlUtil.getAssetUrl('/images/hero-background.jpg');
return (
<div
className="h-screen bg-cover bg-center"
style={{ backgroundImage: `url('${bgUrl}')` }}
>
{/* Content */}
</div>
);
}s3://your-bucket/
├── images/
│ ├── logos/
│ │ ├── hsa-logo.png
│ │ └── hsa-logo.svg
│ ├── banners/
│ │ ├── home-hero.jpg
│ │ └── about-banner.jpg
│ └── products/
│ ├── product-001.jpg
│ └── product-002.jpg
├── videos/
│ ├── intro/
│ │ └── welcome.mp4
│ └── tutorials/
│ ├── tutorial-01.mp4
│ └── tutorial-02.mp4
└── documents/
└── pdfs/
└── guide.pdfproduct-image-large.jpg)