Full-Stack Firebase
Udemy
YouTube
Medium
Newsletter
Search…
Introduction
Introduction
Full-Stack Firebase
Why Firebase?
What is serverless?
Prerequisites
Overview & Structure
Write your first query
Links
Downloadable Notes
Firebase Console
Introduction
Walkthrough
Firebase Tools
Introduction
Walkthrough
Firebase Authentication
Introduction
Walkthrough
Challenge
Notes
Cloud Firestore
Introduction
Walkthrough
Security Rules
Indexes
Challenge
Notes
Realtime Database
Introduction
Walkthrough
Security Rules
Challenge
Notes
Cloud Functions for Firebase
Introduction
Walkthrough
Challenge
Notes
Firebase Storage
Introduction
Walkthrough
Security Rules
Challenge
Notes
Cloud Messaging
Introduction
Walkthrough
Challenge
Notes
Firebase Hosting
Introduction
Walkthrough
Challenge
Notes
Powered By
GitBook
Notes
Firebase Hosting
See the
Firebase Hosting doc for web
.
Redirects
1
"hosting"
:
{
2
// Add the "redirects" section within "hosting"
3
"redirects"
:
[
{
4
"source"
:
"/foo"
,
5
"destination"
:
"/bar"
,
6
"type"
:
301
7
},
{
8
"source"
:
"/firebase/*"
,
9
"destination"
:
"https://firebase.google.com"
,
10
"type"
:
302
11
}
]
12
}
Copied!
Rewrites
1
"hosting"
:
{
2
// Add the "rewrites" section within "hosting"
3
"rewrites"
:
[
{
4
"source"
:
"**"
,
5
"destination"
:
"/index.html"
6
}
]
7
}
Copied!
Headers
1
"hosting"
:
{
2
// Add the "headers" section within "hosting".
3
"headers"
:
[
{
4
"source"
:
"**/*
[email protected]
(eot|otf|ttf|ttc|woff|font.css)"
,
5
"headers"
:
[
{
6
"key"
:
"Access-Control-Allow-Origin"
,
7
"value"
:
"*"
8
}
]
9
},
{
10
"source"
:
"**/*
[email protected]
(jpg|jpeg|gif|png)"
,
11
"headers"
:
[
{
12
"key"
:
"Cache-Control"
,
13
"value"
:
"max-age=7200"
14
}
]
15
},
{
16
// Sets the cache header for 404 pages to cache for 5 minutes
17
"source"
:
"404.html"
,
18
"headers"
:
[
{
19
"key"
:
"Cache-Control"
,
20
"value"
:
"max-age=300"
21
}
]
22
}
]
23
}
Copied!
Connect a Cloud Function
1
{
2
"hosting"
:
{
3
"public"
:
"public"
,
4
5
// Add the following rewrites section *within* "hosting"
6
"rewrites"
:
[
{
7
"source"
:
"/bigben"
,
"function"
:
"bigben"
8
}
]
9
10
}
11
}
Copied!
Firebase Hosting - Previous
Challenge
Last modified
4yr ago
Copy link
Contents
Firebase Hosting
Redirects
Rewrites
Headers
Connect a Cloud Function