Firebase Hosting Limitations & Quotas
Understanding Firebase Hosting's limitations and quotas helps you plan your projects effectively and avoid unexpected issues. This guide covers all limits, quotas, and constraints you need to know.
Resource Limits
Storage Limits
Resource | Free Tier | Paid Tier |
---|---|---|
Total storage | 10 GB | 10 GB |
File size limit | 2 GB | 2 GB |
Total files | 25,000 | 25,000 |
Deployment size | 2 GB | 2 GB |
- Storage is shared across all sites in a project
- Deleted versions still count toward storage for 7 days
- Binary files (images, videos) count against storage quota
Bandwidth Limits
Metric | Free Tier | Paid Tier |
---|---|---|
Monthly bandwidth | 10 GB | Pay as you go |
Bandwidth price | Free | $0.15/GB |
Daily bandwidth | No limit | No limit |
Concurrent connections | No limit | No limit |
Domain Limits
Feature | Limit |
---|---|
Custom domains per project | 50 |
Subdomains per domain | Unlimited |
SSL certificates | Automatic (unlimited) |
Domain verification timeout | 24 hours |
DNS propagation | Up to 48 hours |
Technical Constraints
File and Path Limitations
# Maximum file path length
260 characters (Windows compatibility)
# Reserved URLs (cannot be used)
/__/*
/.well-known/*
/firebase-messaging-sw.js
/firebase.json
/.firebaserc
# File name restrictions
- No spaces at start/end
- No special characters: < > : " | ? *
- Case-sensitive on deployment
Deployment Constraints
Constraint | Limit | Notes |
---|---|---|
Deployment frequency | No limit | Recommended: max 1 per minute |
Deployment time | 30 minutes max | Usually completes in 1-2 minutes |
Rollback window | 30 days | Keep last 100 versions |
Preview channels | 100 active | Auto-expire after 7 days |
Concurrent deployments | 1 per site | Queue additional deployments |
Configuration File Limits
{
"hosting": {
// Max redirects: 1000
"redirects": [],
// Max rewrites: 100
"rewrites": [],
// Max headers rules: 200
"headers": [],
// Max file size: 2MB
"firebase.json": "< 2MB"
}
}
Performance Limitations
Request and Response Limits
Metric | Limit | Details |
---|---|---|
Request size | 32 MB | Including headers |
Response size | 32 MB | Compressed size |
Header size | 8 KB | Per header |
URL length | 2048 chars | Including query string |
Timeout | 60 seconds | For dynamic content |
Requests per second | No hard limit | Subject to abuse prevention |
CDN Limitations
Edge Locations: 200+ worldwide
Cache Invalidation: Automatic on deploy
Cache Purge Time: 5-10 minutes globally
Regional Restrictions: Cannot block regions
Custom CDN: Cannot use external CDN
CDN Logs: Not available (use Cloud Logging)
Feature Limitations
What Firebase Hosting CANNOT Do
❌ Server-Side Processing
- No PHP, Ruby, Python execution
- No database connections
- No server-side sessions
- Use Cloud Functions or Cloud Run instead
❌ Advanced Routing
- No regex in redirects (only in firebase.json)
- No conditional redirects based on headers
- No A/B testing built-in
- Limited to pattern matching
❌ File System Access
- No directory listing
- No runtime file modifications
- No .htaccess support
- Static files only
❌ Custom Configuration
- No custom nginx/Apache configs
- No WebSocket support (use Cloud Run)
- No gRPC support
- No custom SSL certificates
Comparison with Other Services
Feature | Firebase Hosting | Traditional Hosting |
---|---|---|
PHP/Server languages | ❌ | ✅ |
Database access | Via API only | ✅ |
File uploads | ❌ | ✅ |
Custom server config | ❌ | ✅ |
Global CDN | ✅ | Costs extra |
SSL certificates | ✅ Free | Often costs extra |
Deploy speed | Seconds | Minutes to hours |
Security Limitations
Authentication and Access Control
Public Access: All files are public
Authentication: No built-in auth for static files
Access Control: Use Security Rules for dynamic content
IP Restrictions: Not supported
Password Protection: Not supported for hosting
To implement authentication:
- Use Firebase Authentication
- Serve content through Cloud Functions
- Check auth state client-side
- Redirect unauthorized users
CORS and Security Headers
Default CORS behavior:
- Same-origin only by default
- Must configure headers explicitly
- Cannot use wildcard with credentials
{
"headers": [{
"source": "/api/**",
"headers": [{
"key": "Access-Control-Allow-Origin",
"value": "https://example.com"
}]
}]
}
Integration Limitations
Cloud Functions Integration
Aspect | Limit |
---|---|
Function timeout | 60 seconds (Hosting) |
Request size | 32 MB |
Regions | Must match Hosting region |
Cold starts | Can cause delays |
Concurrent executions | 1000 (can be increased) |
Cloud Run Integration
Aspect | Limit |
---|---|
Container size | 2 GB |
Memory | 32 GB max |
CPUs | 8 vCPUs max |
Timeout | 60 minutes max |
Regions | Limited availability |
Billing and Cost Limitations
Free Tier Limits (Spark Plan)
Storage: 10 GB total
Bandwidth: 10 GB/month
Custom domains: Supported
SSL: Free unlimited
Functions: Not available
Cloud Run: Not available
Paid Tier (Blaze Plan)
Storage: $0.026/GB/month after 10GB
Bandwidth: $0.15/GB after 10GB
Minimum charge: None
Billing granularity: Per byte
Payment methods: Credit card required
Spending limits: Can be configured
Hidden Costs to Consider
- Cloud Functions invocations - If using dynamic content
- Cloud Run compute time - For containerized apps
- Outbound API calls - From Functions/Run
- Cloud Build minutes - For container builds
- Firebase Auth users - If implementing auth
Workarounds and Solutions
Exceeding File Limits
// Solution 1: Use Cloud Storage for large files
const largeFileUrl = 'https://storage.googleapis.com/bucket/large-file.zip';
// Solution 2: Split deployments
// Deploy assets separately from HTML
firebase deploy --only hosting:assets
firebase deploy --only hosting:app
Handling Dynamic Content
// Option 1: Cloud Functions
export const api = functions.https.onRequest((req, res) => {
// Dynamic logic here
});
// Option 2: Cloud Run
// Deploy containerized app with any runtime
Managing Multiple Environments
# Use multiple projects
firebase use --add production
firebase use --add staging
firebase use --add development
# Or use preview channels
firebase hosting:channel:deploy feature-x
Monitoring Usage
Check Current Usage
-
Firebase Console
- Project Settings → Usage and billing
- Hosting → Usage tab
-
Firebase CLI
firebase hosting:sites:list
firebase hosting:versions:list -
Set Budget Alerts
- Google Cloud Console → Budgets & alerts
- Set thresholds at 50%, 80%, 100%
Usage Optimization Tips
-
Reduce bandwidth usage
- Optimize images (WebP format)
- Enable compression
- Set proper cache headers
-
Manage storage
- Delete old deployments
- Remove unused files
- Use external storage for large assets
-
Monitor preview channels
- Set expiration dates
- Clean up after testing
- Use
--expires 1d
for short tests
Best Practices for Limits
Design Considerations
✅ DO:
- Plan for growth within limits
- Monitor usage regularly
- Implement caching strategies
- Use CDN effectively
- Consider hybrid architectures
❌ DON'T:
- Store user uploads in Hosting
- Exceed 25,000 files
- Deploy massive unoptimized images
- Ignore bandwidth costs
- Assume unlimited resources
Scaling Strategies
When approaching limits:
- Optimize first - Compress, cache, minimize
- Offload assets - Use Cloud Storage for large files
- Split projects - Distribute across multiple projects
- Use edge functions - Reduce origin requests
- Consider alternatives - Evaluate if Hosting fits your scale
Frequently Asked Questions
Q: Can I increase storage limits? A: No, 10GB is a hard limit. Use Cloud Storage for additional needs.
Q: What happens if I exceed bandwidth? A: Spark plan: Hosting stops serving. Blaze plan: You're charged $0.15/GB.
Q: Can I host videos? A: Technically yes, but not recommended. Use Cloud Storage or YouTube.
Q: Are WebSockets supported? A: No, use Cloud Run for WebSocket connections.
Q: Can I run cron jobs? A: Not directly. Use Cloud Scheduler with Cloud Functions.
Next Steps
- Review CDN Management for optimization
- Explore Backend Integration for dynamic content
- Set up Monitoring to track usage
- Read Performance guide for optimization tips
Remember: Firebase Hosting is optimized for static content delivery. For dynamic features beyond these limitations, integrate with Cloud Functions or Cloud Run! 🚀