I currently have an app deployed to Firebase hosting with the following structure:
public/
appSub1/
index.html
appSub2
index.html
index.html
I have already added and connected my subdomains such that
appSub1.mysite.com/ -> app.firebaseapp.com/
appSub2.mysite.com/ -> app.firebaseapp.com/
I am trying to configure the redirects to properly associate the subdomains with the correct app subfolder such that
appSub1.mysite.com/ -> app.firebaseapp.com/appSub1/
appSub2.mysite.com/ -> app.firebaseapp.com/appSub2/
The app is still correctly displayed if I manually add the sub paths, but not without them. So going to appSub1.mysite.com/
just ends up at a blank page, but going to appSub1.mysite.com/appSub1/
ends up at the correct index.html
This is my current hosting configuration in firebase.json
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "appSub1.mysite.com/**",
"destination": "/appSub1/**",
"type": 301
},
{
"source": "appSub2.mysite.com/**",
"destination": "/appSub2/**",
"type": 301
}
]
},
Each domain name can have up to 500 subdomains. You can also add multiple levels of subdomains, such as info.blog.yoursite.com. A subdomain can be up to 255 characters long, but if you have multiple levels in your subdomain, each level can only be 63 characters long.
Yes. You can have as many levels as you like in DNS.
Consider using automatic SDK configuration to mirror multiple environments using a single codebase. The multisite feature supports a maximum of 36 sites per Firebase project.
Select the project you want to use for a different environment, and then give it an alias. The alias can really be whatever you want, but it's common to use aliases like “development”, “staging”, or “production”. Once you've created a new alias, it will be set as the current environment for deployment.
I recommend the following:
public/app1
and public/app2
into two separate hosting project targets - say app1
and app2
- thus, by default the hosting address would be app1.firebaseapp.com
and app2.firebaseapp.com
(or now as of May 2019, you'll get a .web.app
domain as well - app1.web.app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With