Local Testing with Emulators
Test your Firebase Hosting site locally before deploying.
Setup Firebase Emulators​
# Initialize emulators
firebase init emulators
# Select Hosting emulator
# Configure ports (default: 5000)
Running Locally​
# Start hosting emulator
firebase emulators:start --only hosting
# With other services
firebase emulators:start --only hosting,functions
# With custom port
firebase emulators:start --only hosting --port 3000
Testing Features​
Test Rewrites​
{
"hosting": {
"rewrites": [{
"source": "/api/**",
"function": "api"
}]
}
}
Test Headers​
Headers are applied in local emulator just like production.
Test Redirects​
All redirects work locally for testing.
Coming Soon​
This documentation is being expanded. For now, please refer to:
- Firebase Emulators docs
- Configuration Guide for testing configs