Firebase Hosting Features
Discover all the powerful features that make Firebase Hosting the perfect choice for modern web development.
🚀 Core Features
Global Content Delivery Network (CDN)
- 200+ edge locations worldwide
- Automatic geo-routing to nearest server
- SSD storage at every edge location
- Smart caching with automatic invalidation
Automatic SSL Certificates
- Free SSL for all domains
- Auto-renewal - never worry about expiration
- Custom domain support with easy verification
- Wildcard certificates for subdomains
Instant Rollbacks
- Version history for every deployment
- One-click rollback from console
- Zero downtime during rollbacks
- Deployment notes for tracking changes
🛠️ Developer Experience
Preview Channels
Create temporary preview URLs to test changes before going live:
# Deploy to a preview channel
firebase hosting:channel:deploy my-feature
# Your preview URL
https://PROJECT--my-feature-HASH.web.app
Benefits:
- Share with teammates for feedback
- Test with real production data
- Automatic expiration after 30 days
- Multiple channels simultaneously
GitHub Integration
Automatic deployments with every push:
name: Deploy to Firebase Hosting on merge
on:
push:
branches: [ main ]
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
channelId: live
Local Development
Test everything locally before deploying:
# Start local emulator
firebase emulators:start
# Access at http://localhost:5000
Features:
- Hot reload support
- Integration with other Firebase emulators
- Production-like environment
- Network condition simulation
🎯 Advanced Capabilities
Multi-Site Hosting
Host multiple sites from one project:
# Create additional sites
firebase hosting:sites:create blog
firebase hosting:sites:create docs
firebase hosting:sites:create app
# Deploy to specific site
firebase target:apply hosting blog blog-site
firebase deploy --only hosting:blog
Use Cases:
- Separate marketing and app sites
- Different sites for regions
- Staging and production environments
- Microsite campaigns
Internationalization (i18n)
Serve content in multiple languages:
{
"hosting": {
"public": "public",
"i18n": {
"root": "/localized-files"
}
}
}
Structure:
/localized-files/
/en/
index.html
/es/
index.html
/fr/
index.html
URL Rewrites and Redirects
Redirects
{
"hosting": {
"redirects": [
{
"source": "/old-page",
"destination": "/new-page",
"type": 301
},
{
"source": "/admin",
"destination": "https://admin.example.com",
"type": 302
}
]
}
}
Rewrites for SPAs
{
"hosting": {
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Dynamic Content with Functions
{
"hosting": {
"rewrites": [
{
"source": "/api/**",
"function": "api"
}
]
}
}
Custom Headers
Control caching, security, and more:
{
"hosting": {
"headers": [
{
"source": "**/*.@(js|css)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31536000"
}
]
},
{
"source": "**/*.@(jpg|jpeg|gif|png)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=86400"
}
]
},
{
"source": "**",
"headers": [
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
}
]
}
]
}
}
📊 Monitoring & Analytics
Web Request Logs
- Real-time request monitoring
- Detailed performance metrics
- Error tracking and debugging
- Export to BigQuery for analysis
Performance Monitoring
- Core Web Vitals tracking
- Geographic performance data
- Device and browser breakdowns
- Custom performance marks
Usage Metrics
- Bandwidth consumption
- Request counts
- Geographic distribution
- File-level analytics
🔒 Security Features
Automatic Security Headers
- HSTS enabled by default
- X-Content-Type-Options: nosniff
- X-Frame-Options configurability
- Content Security Policy support
Access Control
- IP-based restrictions
- Country-level blocking
- Firebase App Check integration
- Custom authentication rules
DDoS Protection
- Automatic rate limiting
- Traffic spike protection
- Global load distribution
- Abuse prevention
💰 Pricing & Limits
Free Tier (Spark Plan)
- 10 GB storage
- 360 MB/day bandwidth
- Custom domain support
- SSL certificates
Pay-as-you-go (Blaze Plan)
- $0.026/GB storage
- $0.15/GB bandwidth
- Unlimited sites
- All features included
No Limits On
- Number of deployments
- Preview channels
- Custom domains
- SSL certificates
🎨 Use Case Examples
Static Sites
Perfect for:
- Documentation sites
- Marketing pages
- Blogs
- Portfolio sites
Single Page Applications
Optimized for:
- React apps
- Vue.js apps
- Angular apps
- Svelte apps
Progressive Web Apps
Features for PWAs:
- Service worker support
- Offline functionality
- App shell caching
- Push notifications (with FCM)
Dynamic Sites
With Cloud Functions/Run:
- Server-side rendering
- API endpoints
- Form processing
- Authentication flows
🚦 Getting Started with Features
- Start Simple: Deploy a static site
- Add Preview Channels: Test features safely
- Configure Caching: Optimize performance
- Set Up CI/CD: Automate deployments
- Add Dynamic Content: Expand functionality
Each feature is designed to work seamlessly together, allowing you to start simple and scale as needed. Firebase Hosting grows with your application!