I want to set firebase two subdomain [duplicate] - firebase

I have purchased a domain ("www.mydomain.com"). How do I make a subdomain on Firebase ("sub.mydomain.com"), if I am using Firebase hosting?

Update
You can now add multiple domains to a single Firebase Hosting site. Domains can either serve site content or redirect to another domain (editable at any time). In addition, you can now use subdomains of the same registered domain on different projects, such as example.com on one project and blog.example.com on another. Visit your hosting admin page to configure them.
Original answer
If you point multiple subdomains of mydomain.com to Firebase Hosting, it will redirect others to the one you chose when specifying your custom domain. If you're looking to simply serve content from one subdomain, all you need do is specify that one in the custom domain field on you Hosting tab and point your DNS for that subdomain to Firebase Hosting, following the instructions provided.
If, however, you're looking to serve different content on different subdomains, that's not currently possible, though this is a highly requested feature that we're considering implementing

i believe you can use rewritte rules on the hosting configuration json file
since all domains and subdomains you point to your firebase project will be redirected to your single firebase hosting bucket, youll need to set up custom rewrite rules for each domain you want to separate, to redirect them to an specific folder or cloud function in your project.
i suggest to check the next url as reading material, its a new techinque to work with projects in firebase
https://github.com/jthegedus/firebase-functions-next-example
on your firebase.json file
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"rewrites": [
{
"source": "/.well-known/assetlinks.json",
"destination": "/instant/assetlinks.json"
},
{
"source": "sub.domain.com/**",
"destination": "/subdomain/**"
}
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}

Related

Is it possible to change url displayed in address bar for my firebase web?

I bought a domain called xxx.net from godaddy.
When I type this address in browser, it gives the firebase page.
However, the url displayed in the address bar automatically changes to xxx.firebaseapp.com .
I want to change the url displayed to be xxx.net.
How can I do it?
Thank you!
Here is my firebase json.
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
}
It sounds like you've set up a redirect from your custom domain at GoDaddy to the default domain that Firebase created for you.
If you follow the Firebase instructions on connecting a custom domain, you will add A records to your DNS (at GoDaddy), which serve the exact same content as you currently see, but then directly when you type in your own domain name, instead of with a redirection.
If you're having a hard time making this work, edit your question to show how you've set up your DNS zone at GoDaddy, and how you configured the domain in the Firebase Hosting console. The firebase.json file has no setting that are relevant to the custom domain.

set up custom route for dynamic link, without using firebase hosing

According to the firebase official documentation, to set up a custom route like /link in your custom domain like example.com, I need to use firebase hosting already and do the following configuration there:
"hosting": {
// ...
"appAssociation": "AUTO",
"rewrites": [
{
"source": "/link/**",
"dynamicLinks": true
},
]
}
But I'm not using firebase hosting, and Obviously, I don't have such a configuration.
So I can have the same result with no firebase hosting?
This has worked for me in the past with custom domain names for dynamic links: when you get the error in the dynamic links page, open the Authentication(you don't actually need to use firebase authentication on this project for this to work), go to sign in method, enable Email/Password then scroll down to Authorized Domains and add your domain as an authorized domain. This won't affect your current website or email. Go back to hosting and try to set up the URL prefix again.

How deploy two app on the same domain firebase? [duplicate]

I have purchased a domain ("www.mydomain.com"). How do I make a subdomain on Firebase ("sub.mydomain.com"), if I am using Firebase hosting?
Update
You can now add multiple domains to a single Firebase Hosting site. Domains can either serve site content or redirect to another domain (editable at any time). In addition, you can now use subdomains of the same registered domain on different projects, such as example.com on one project and blog.example.com on another. Visit your hosting admin page to configure them.
Original answer
If you point multiple subdomains of mydomain.com to Firebase Hosting, it will redirect others to the one you chose when specifying your custom domain. If you're looking to simply serve content from one subdomain, all you need do is specify that one in the custom domain field on you Hosting tab and point your DNS for that subdomain to Firebase Hosting, following the instructions provided.
If, however, you're looking to serve different content on different subdomains, that's not currently possible, though this is a highly requested feature that we're considering implementing
i believe you can use rewritte rules on the hosting configuration json file
since all domains and subdomains you point to your firebase project will be redirected to your single firebase hosting bucket, youll need to set up custom rewrite rules for each domain you want to separate, to redirect them to an specific folder or cloud function in your project.
i suggest to check the next url as reading material, its a new techinque to work with projects in firebase
https://github.com/jthegedus/firebase-functions-next-example
on your firebase.json file
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"rewrites": [
{
"source": "/.well-known/assetlinks.json",
"destination": "/instant/assetlinks.json"
},
{
"source": "sub.domain.com/**",
"destination": "/subdomain/**"
}
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}

Multiple apps pointing to different subdomains on Firebase [duplicate]

I have purchased a domain ("www.mydomain.com"). How do I make a subdomain on Firebase ("sub.mydomain.com"), if I am using Firebase hosting?
Update
You can now add multiple domains to a single Firebase Hosting site. Domains can either serve site content or redirect to another domain (editable at any time). In addition, you can now use subdomains of the same registered domain on different projects, such as example.com on one project and blog.example.com on another. Visit your hosting admin page to configure them.
Original answer
If you point multiple subdomains of mydomain.com to Firebase Hosting, it will redirect others to the one you chose when specifying your custom domain. If you're looking to simply serve content from one subdomain, all you need do is specify that one in the custom domain field on you Hosting tab and point your DNS for that subdomain to Firebase Hosting, following the instructions provided.
If, however, you're looking to serve different content on different subdomains, that's not currently possible, though this is a highly requested feature that we're considering implementing
i believe you can use rewritte rules on the hosting configuration json file
since all domains and subdomains you point to your firebase project will be redirected to your single firebase hosting bucket, youll need to set up custom rewrite rules for each domain you want to separate, to redirect them to an specific folder or cloud function in your project.
i suggest to check the next url as reading material, its a new techinque to work with projects in firebase
https://github.com/jthegedus/firebase-functions-next-example
on your firebase.json file
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"rewrites": [
{
"source": "/.well-known/assetlinks.json",
"destination": "/instant/assetlinks.json"
},
{
"source": "sub.domain.com/**",
"destination": "/subdomain/**"
}
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}

Firebase route security without AngularFire

I'm creating a web application using Firebase as the backend for data storage, real-time updates, as well as for hosting.
Moving most things client-side is pretty slick, but the issue of security is an important one to address.
For access to data on Firebase, Firebase Security Rules takes care of most things. But, when using Firebase for hosting, I feel like there is a lack of security for accessing certain routes.
Currently, on a page load, I can check to see whether or not a user is logged in. If the user isn't logged in (or if the auth token isn't valid) I can redirect the user to a different page (i.e. a Login page). But, my issue is what if there is information embedded in the static html on that page that I wouldn't want an unauthorized user to see?
I feel like the first answer that I'll receive is, "The data should be kept in a Firebase variable and loaded only if the authorization is successful." While that is a valid option, I'm thinking storage of HTML (or even just paragraphs of text) as a Firebase variable is kludgy, and there ought to be a better way.
Initially I thought that this would be an inherent option in the firebase.json file, as one can define redirects, headers, etc. But, there is nothing in firebase.json for security (like in firebase-security.json) that would allow me perform an auth check such as the following:
{
"firebase": "myfirebase",
"public": "app",
"ignore": [],
"rules": "config/security-rules.json",
"routes": [ {
"source" : "/for_authorized_only/",
"destination": "/authorized_page.html",
"auth": true, //Must be authorized
}, {
"source": "/some_public_route",
"destination": "index.html",
"auth": false, //No auth required to access this page
} ]
}
I haven't tried out AngularJS or AngularFire, but after searching a little it seems like the angularFire-seed project includes route security, however this should be included in Firebase rather than rely on another framework!
Is there something that I'm looking over that would allow me to accomplish this?

Resources