If social media platforms can't access your Firebase Storage images, you may need to configure CORS.
npm install -g firebase-toolsfirebase loginfirebase initCreate a file called cors.json in your project root:
[
{
"origin": ["*"],
"method": ["GET", "HEAD"],
"maxAgeSeconds": 3600
}
]gsutil cors set cors.json gs://your-firebase-storage-bucketReplace your-firebase-storage-bucket with your actual bucket name (e.g., blog-d85ac.appspot.com)
If CORS issues persist, consider using Cloudinary for image hosting:
- Go to https://cloudinary.com/
- Create a free account
// In createBlog.jsx, replace Firebase upload with Cloudinary
const uploadToCloudinary = async (file) => {
const formData = new FormData();
formData.append('file', file);
formData.append('upload_preset', 'your_upload_preset');
const response = await fetch('https://api.cloudinary.com/v1_1/your_cloud_name/image/upload', {
method: 'POST',
body: formData
});
const data = await response.json();
return data.secure_url;
};- Upload a new blog post with thumbnail
- Test the social media preview
- Wait 24-48 hours for cache refresh
If all else fails, use the Unsplash fallback image which is already configured and working.