Firebase: Host a folder to subdomain without creating new site - firebase-hosting

I have a website structured like this (where build is public directory of my firebase app) :
build/
├─ Creator/
│ ├─ index.html
├─ artist.html
├─ index.html
├─ song.html
├─ ...etc
The build directory is hosted at myapp.com
And I want to rewrite myapp.com/Creator to creator.myapp.com, and its descendants as well. How can I achieve such without creating another site on my Firebase hosting?
301 and 302 redirects do not work, and it's not intended for this I guess...
My firebase.json:
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"redirects": [{
"type": 301,
"source": "/Creator{,/**}",
"destination": "https://creators.myapp.com"
}],
"cleanUrls": true,
"trailingSlash": false
}
}

Related

firebase hosting with react build or public?

I want to host my react app build folder in to firebase hosing but my app re initialization
changed some stuff in my settings .. how to make firebase hosing send my build folder to the cloud ?
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},

VS Code: Add single file (README) to multi-root workspace

You can configure a vs-code multi-root workspace to include several folders. Eg,
{
"folders": [
{
// Source code
"name": "Product",
"path": "vscode"
},
{
// Docs and release notes
"name": "Documentation",
"path": "vscode-docs"
},
{
// Yeoman extension generator
"name": "Extension generator",
"path": "vscode-generator-code"
}
]
}
I would also like to include a README file from a root directory that pertains to all those folders. Is there a way to do this?

Add github repository to my composer project

I like to create a new composer project. I will include code, that is not on packagist. It is a github repository. Concretely I like to include this release.
https://github.com/joomla/joomla-cms/releases/tag/4.0.0-alpha12
I expected with this composer.json to fetch the release 4.0.0-alpha12:
{
"name": "vendor/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "git",
"url": "https://github.com/joomla/joomla-cms.git"
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}
But the command comoser install did not run to the end. This is my message
composer install
Loading composer repositories with package information
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "git clone --mirror 'https://github.com/joomla/joomla-cms.git' '/home/astrid/.composer/cache/vcs/htt
ps---github.com-joomla-joomla-cms.git/'" exceeded the timeout of 300 seconds.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
In the end I have a vendor directory in my project folder. The content of the github repository is not there.
What do I have to do if I want to add code - hosted on github - to my Composer project?
Update
I just changed my composer.json to
{
"name": "astrid/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "package",
"package": {
"name": "joomla/joomla-cms",
"version": "4.0.0-alpha12",
"source": {
"type": "git",
"url": "git://github.com/joomla/joomla-cms.git",
"reference": "4.0-dev"
},
"dist": {
"url": "https://github.com/joomla/joomla-cms/releases/download/4.0.0-alpha12/Joomla_4.0.0-alpha12-Alpha-Full_Package.zip",
"type": "zip"
}
}
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}
Now I get this error.
composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package joomla/joomla-cms dev-4.0-dev#4.0.0-alpha12 exists as joomla/joomla-cms[4.0.0-alpha12] but these are rejected by your constraint.
What am I doing wrong? I haven't assigned any dependencies or restrictions yet.
I'm not sure what exactly causes your "rejected by your constraint" exception, but I'm guessing it's because you're using the branch#ref version requirement which the docs say isn't actively supported. I think you could rather just use the 4.0.0-alpha12 tag since a tag isn't tied to a branch.
To fix your first issue, change your repository type to vcs (or github). Composer will detect the the repository is a Github repository and will then use the Github API to fetch the correct version of the package. The joomla-cms repository looks really big so it will probably take longer than the allowed 300 seconds to clone.
"repositories": [
{
"type": "vcs",
"url": "https://github.com/joomla/joomla-cms.git"
}
]
For your second issue, set your version to 4.0.0-alpha12:
"require": {
"joomla/joomla-cms": "4.0.0-alpha12"
}
The 4.0.0-alpha12 version of joomla-cms requires a dev version of joomla/application (joomla/application[2.0.x-dev]) so you would have to set your package's minimum stability to dev:
"minimum-stability": "dev",

Unable to add Firebase Dynamic Links to a project using a custom domain

I've created Firebase Dynamic Links in other projects before using the page.link URL prefix (the only option at the time). However that no longer appears to be an option when enabling Dynamic Links for a new project today. It looks like the docs for custom domains were updated today. Unfortunately, while they provide some helpful examples, they don't explain how to resolve my issue in a way that I can understand.
So this message seems to indicate that I need to "Put links under a subpath". It seems to me that adding the /link path prefix here should accomplish that? But after making that change, I get the same error message.
It looks like you already have content served on this Hosting site. Put links under a subpath to avoid conflicts with existing content.
I order to try to work around this, I went to my project and added the suggested Hosting configuration and deployed it.
firebase.json:
{
"hosting": {
"public": "dist",
"ignore": [
"**/.*"
],
"appAssociation": "AUTO",
"rewrites": [
{
"source": "/link/**",
"dynamicLinks": true
},
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Even after waiting an hour, I keep getting the same error and I don't understand what to do.
Note that I have the rewrite to /index.html because I have an Angular Single Page Application hosted at www.devintent.com.
No matter what I do, I keep getting this error and the Continue button stays disabled. I tried using my naked domain devintent.com instead of www.devintent.com, but that didn't help. I tried using links.devintent.com, but got the same error.
If I manually remove disabled from the Continue button, then I get this error message:
This links to the docs for manually configuring hosting for dynamic links which has some steps that I've already completed. Clicking the Check Again button just takes me back to the same error in the first image above.
Workaround to not use Custom Domains
I'm happy at this time to use a page.link link, I just need to create a Dynamic Link and get unblocked on this task, but I can't figure out any way in the console to allow me to do that either.
Update on this: I figured out that I needed to add the subdomain to the page.link URL. The tooltip says "or a free Google-provided domain (for example, yourapp.page.link)" at the end. This is a little less prominent that I would have liked (as I didn't find it for quite a long time). Using devintent.page.link works for me as a workaround for now.
However, I'm not sure why the Custom Domain configuration didn't work and why it would be the default if there are such complications with projects with existing Hosting configurations and custom domains.
I had the same issue and got the same error. The problem was that I was redirecting all the routes to index.html. The solution was to restrict the routes to index.html by exclusion.
"rewrites": [
{
"source": "/link/**",
"dynamicLinks": true
},
{
"source": "!/link/**",
"destination": "/index.html"
}
]
After deploying the new configuration to Firebase Hosting, I was allowed to use mydomain.example/link as desired.
I had a similar problem with the root (apex) domain. Basically, if the prefix (the apex domain in my case) is a URL that gives 200 status response, it won't be accepted. In my case the there was an index.html file inside the public folder. I renamed it to something else and it worked.
Here's my firebase.json:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"appAssociation": "AUTO",
"rewrites": [ { "source": "/**", "dynamicLinks": true } ]
}
}
Everything you are doing looks correct with regards to getting your custom domain working. I am wondering if you are using the latest version of firebase-tools (CLI). Custom Domain support for dynamic links was added in version 6.5.0.
Good news is that page.link support still exists but is not as obvious in the new UI flow. The way to get a page.link domain is to start typing your desired subdomain and a suggestion should pop up in the UI. I have included a screenshot to show how this would work.
Adding page link domain image
Hope this helps,
Jeff
For us the issue was that we we're using the default Firebase Hosting site for serving our web-app at all routes ("/**"). Serving our web-app from a different domain that dynamic links is the way it should be for us, since links should not interfere with the web-app.
To serve links from a different domain than our web-app, I created a new site just for links and attached our custom domain to that site. Now we have two Firebase Hosting sites. The first default one for our web-app and the second one for Firebase Dynamic Links.
After this setting up Dynamic Links with a custom domain attached to the second Firebase Hosting site worked flawlessly.
See the screenshot for more details:
EDIT1: the web-app's firebase.json as requested by #cocacrave:
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"function": "nuxtApp"
}
]
}
}
If you are getting this error with subdomain, this solution worked for me:
{
"hosting": [
{
"target": "app",
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"appAssociation": "AUTO",
"rewrites": [
{
"source": "/**",
"destination": "/index.html"
}
]
},
{
"target": "links",
"public": "build",
"ignore": [
"**"
],
"appAssociation": "AUTO",
"redirects": [
{
"source": "/",
"destination": "{{your domain}}",
"type": 302
}
],
"rewrites": [
{
"source": "/**",
"dynamicLinks": true
}
]
},
{
"target": "invite",
"public": "build",
"ignore": [
"**"
],
"redirects": [
{
"source": "/",
"destination": "{{your domain}}",
"type": 302
}
],
"appAssociation": "AUTO",
"rewrites": [
{
"source": "/**",
"dynamicLinks": true
}
]
}
]
}
"appAssociation": "AUTO",
"rewrites": [
{
"source": "/page/**",
"destination": "/index.html"
},
{
"source": "/link/**",
"dynamicLinks": true
}
]
It works! I guess the error caused by the original config of "source":"**". May be the range is too large? Though doc say "/__/*" have high priority. (https://firebase.google.com/docs/hosting/full-config?authuser=0#hosting_priority_order)

Could not find package * at any version for your minimum-stability (stable). Check the package spelling or your min imum-stability

I have pushed my project to this address:
https://github.com/mojtabagithub/jdf-library.
But when I run this:
composer require rayvarzshiraz/jdf .
which is it's command to require, I get this error:
Could not find package rayvarzshiraz/jdf at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability.
This is my composer.json file :
{
"name": "rayvarzshiraz/jdf",
"minimum-stability": "stable",
"description": "A module for jdf persian calender library",
"keywords": [
"jdf",
"persian",
"calender",
"symfony"
],
"type": "library",
"authors": [
{
"name": "Mojtaba Dehdari",
"email": "mojtabadehdari#gmail.com",
"homepage": "http://jdf.scr.ir/"
}
],
"support": {
"email": "mojtabadehdari#gmail.com"
},
"require": {
},
"autoload": {
"files": ["lib/autoload.php"]
}
}
You must create a release in your GitHub repository.
For it, create a tag:
git tag -tag_name-
Then send the tag:
git push origin master -tag_name-
or
Go to your github repository and click in "releases" (this link https://github.com/mojtabagithub/jdf-library/releases) and follow the instructions.
Finally, update the packlist.org package