Skip to main content

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​

ResourceFree TierPaid Tier
Total storage10 GB10 GB
File size limit2 GB2 GB
Total files25,00025,000
Deployment size2 GB2 GB
Storage Notes
  • 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​

MetricFree TierPaid Tier
Monthly bandwidth10 GBPay as you go
Bandwidth priceFree$0.15/GB
Daily bandwidthNo limitNo limit
Concurrent connectionsNo limitNo limit

Domain Limits​

FeatureLimit
Custom domains per project50
Subdomains per domainUnlimited
SSL certificatesAutomatic (unlimited)
Domain verification timeout24 hours
DNS propagationUp 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​

ConstraintLimitNotes
Deployment frequencyNo limitRecommended: max 1 per minute
Deployment time30 minutes maxUsually completes in 1-2 minutes
Rollback window30 daysKeep last 100 versions
Preview channels100 activeAuto-expire after 7 days
Concurrent deployments1 per siteQueue 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​

MetricLimitDetails
Request size32 MBIncluding headers
Response size32 MBCompressed size
Header size8 KBPer header
URL length2048 charsIncluding query string
Timeout60 secondsFor dynamic content
Requests per secondNo hard limitSubject 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​

FeatureFirebase HostingTraditional Hosting
PHP/Server languages❌✅
Database accessVia API only✅
File uploads❌✅
Custom server config❌✅
Global CDN✅Costs extra
SSL certificates✅ FreeOften costs extra
Deploy speedSecondsMinutes 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:

  1. Use Firebase Authentication
  2. Serve content through Cloud Functions
  3. Check auth state client-side
  4. 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​

AspectLimit
Function timeout60 seconds (Hosting)
Request size32 MB
RegionsMust match Hosting region
Cold startsCan cause delays
Concurrent executions1000 (can be increased)

Cloud Run Integration​

AspectLimit
Container size2 GB
Memory32 GB max
CPUs8 vCPUs max
Timeout60 minutes max
RegionsLimited 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
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​

  1. Cloud Functions invocations - If using dynamic content
  2. Cloud Run compute time - For containerized apps
  3. Outbound API calls - From Functions/Run
  4. Cloud Build minutes - For container builds
  5. 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​

  1. Firebase Console

    • Project Settings → Usage and billing
    • Hosting → Usage tab
  2. Firebase CLI

    firebase hosting:sites:list
    firebase hosting:versions:list
  3. Set Budget Alerts

    • Google Cloud Console → Budgets & alerts
    • Set thresholds at 50%, 80%, 100%

Usage Optimization Tips​

  1. Reduce bandwidth usage

    • Optimize images (WebP format)
    • Enable compression
    • Set proper cache headers
  2. Manage storage

    • Delete old deployments
    • Remove unused files
    • Use external storage for large assets
  3. 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:

  1. Optimize first - Compress, cache, minimize
  2. Offload assets - Use Cloud Storage for large files
  3. Split projects - Distribute across multiple projects
  4. Use edge functions - Reduce origin requests
  5. 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​


Remember: Firebase Hosting is optimized for static content delivery. For dynamic features beyond these limitations, integrate with Cloud Functions or Cloud Run! 🚀