I put the app-ads.txt in the root of my firebase site.
I'm trying redirect to 'www.my-site.com' except 'app-ads.txt'.
Fore example:
www.myFirebase.web.app/index.html --> redirect to www.my-site.com
www.myFirebase.web.app/app-ads.txt --> does not redirect
Here's my firebase.json
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"redirects": [
{
"source": "/",
"destination": "http://www.my-site.com",
"type": 301
},
{
"source": "/**",
"destination": "http://www.my-site.com",
"type": 301
}
]
}
}
What should I do?
Related
I have the following hosting targets in my firebase.json file
{
"hosting": [
{
"target": "staging",
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
{
"target": "production",
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
]
}
And my firebaserc file contains the following:
{
"projects": {
"default": "project-name177137"
},
"targets": {
"project-name177137": {
"hosting": {
"staging": [
"project-name177137"
],
"production": [
"productionName"
]
}
}
}
}
If I want to deploy to all I usually just do firebase deploy.
Now imagine I want to deploy to only staging for testing, what firebase command can I use to achieve that?
Thank you.
firebase deploy --only hosting:staging
documentation
I have an app running as pwa built on angular 6, Now I need to exclude some api calls serving from service worker. These are the api calls i need to exclude
https://example.net/api/firstApi?param1=true¶m2=no
https://example.net/api/secondApi?param1=true¶m2=no
I tried putting ! in front of the urls, still its serving from service worker only.
Below is my config file
{
"index": "/index.html",
"dataGroups": [
{
"name": "api",
"urls": [
"!/**/api/firstApi/**",
"!/**/api/secondApi/**"
],
"cacheConfig": {
"maxSize": 0,
"maxAge": "0u",
"strategy": "freshness"
}
}
],
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"updateMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}
]
}
Thanks in advance!
Using the following firebase.json, I'm able to redirect users to my desired maintenance.html page. However, the page is retrieved with a 304 status code. I would like it to be retrieved with a 503 status code to indicate to a search engine that this is temporary maintenance. I've attempted to set the header manually but it doesn't appear to work. How can this be accomplished in Firebase?
{
"hosting": {
"public": "build",
"ignore": [],
"redirects": [ {
"source": "/index.html",
"destination": "/maintenance.html",
"type": 307
} ],
"rewrites": [
{
"source": "**"
, "destination": "/index.html"
}
],
"headers": [
{
"source": "/maintenance.html",
"headers": [ {
"key": "status",
"value": "503"
} ]
}
]
}
}
Here's what ended up working for me:
{
"hosting": {
"public": "build",
"ignore": [],
"redirects": [
{
"source": "/index.html",
"destination": "/maintenance.html",
"type": 307
}
],
"headers": [
{
"source": "/maintenance.html",
"headers": [ {
"key": "status",
"value": "503"
} ]
}
]
}
}
I am trying to set up an environment where the first time a user logs into chrome they have a list of pre-determined bookmarks and extensions installed. I have followed Chromiums guide to this as much as possible however seem to be failing when it comes to the granted_permissions section, in an ideal world the user would open Chrome and not be prompted with "This extension requires new permissions". From what i can gather this is through the granted_permissions entry however these do not appear to be parsing through to chrome, ive included a snapshot of the code below:
{
"homepage": "MY_URL",
"homepage_is_newtabpage": false,
"extensions": {
"settings": {
"hdokiejnpimakedhajhdlcegeplioahd": {
"location": 1,
"manifest": {
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCiL9y2jziKp5kjb13uYG1bAXsuemUKAYUAwR/N9qTuhMIuly02Ecm63dOkn+M2r26IGfDE/lbPv/dB/W+d34pqGo5uJJY+Omt9t3xsIuz7mQwuvF1H5ozj0OHok5XDFRaBIfPa06RhQw3M7sSZJvQ+qqD3+dr0aLX+mvi0LQ11uQIDAQAB",
"name": "LastPass",
"update_url": "http://clients2.google.com/service/update2/crx",
"granted_permissions": {
"api": [ "contextMenus", "idle", "notifications", "tabs", "unlimitedStorage", "webRequest", "webRequestBlocking" ],
"explicit_host": [ "http://*/*", "https://*/*" ],
"scriptable_host": [ "file:///*", "http://*/*", "https://*/*", "https://1min-ui-prod.service.lastpass.com/*" ]
},
"version": "0.0"
},
"path": "hdokiejnpimakedhajhdlcegeplioahd\\0.0",
"state": 1
},
"cjpalhdlnbpafiamejdnhcphjbkeiagm": {
"location": 1,
"manifest": {
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmJNzUNVjS6Q1qe0NRqpmfX/oSJdgauSZNdfeb5RV1Hji21vX0TivpP5gq0fadwmvmVCtUpOaNUopgejiUFm/iKHPs0o3x7hyKk/eX0t2QT3OZGdXkPiYpTEC0f0p86SQaLoA2eHaOG4uCGi7sxLJmAXc6IsxGKVklh7cCoLUgWEMnj8ZNG2Y8UKG3gBdrpES5hk7QyFDMraO79NmSlWRNgoJHX6XRoY66oYThFQad8KL8q3pf3Oe8uBLKywohU0ZrDPViWHIszXoE9HEvPTFAbHZ1umINni4W/YVs+fhqHtzRJcaKJtsTaYy+cholu5mAYeTZqtHf6bcwJ8t9i2afwIDAQAB",
"name": "uBlock Origin",
"update_url": "http://clients2.google.com/service/update2/crx",
"version": "0.0"
},
"path": "cjpalhdlnbpafiamejdnhcphjbkeiagm\\0.0",
"state": 1
}
}
},
"session": {
"restore_on_startup": 1,
"startup_urls": [
"MY_URL/"
]
},
"browser": {
"show_home_button": true,
"check_default_browser": false
},
"bookmark_bar": {
"show_on_all_tabs": true
},
"distribution": {
"show_welcome_page": false,
"skip_first_run_ui": true,
"import_history": false,
"import_bookmarks_from_file": "/Library/Google/bookmarks.html",
"import_bookmarks": false,
"import_home_page": false,
"import_search_engine": false
},
"sync_promo": {
"user_skipped": true
}
}
After opening chrome even with those permissions in place it still disables the extensions pending further permissions however im not really sure what else its after.
Wrong structure. If you look at the docs, it should be as follows:
{
"extensions": {
"settings": {
"mihcahmgecmbnbcchbopgniflfhgnkff": {
"location": 1,
"manifest": {
...
},
"granted_permissions": {
"api": [ "tabs" ],
"explicit_host": [ "http://*.google.com/*", "https://*.google.com/" ],
"scriptable_host": [ "http://example.com/" ]
},
...
},
...
}
}
}
However, you have put the "granted_permissions" key inside, and not on the same level as the "manifest" key.
I'm trying to set the Last-Modified header for my resources so they can be properly cached. However, when I run firebase deploy I get the following error:
FIREBASE WARNING: set at /hosting/headers/dstaley failed: permission_denied
Settings Error - Incorrectly formatted "headers" entry in the firebase.json
My firebase.json is as follows:
{
"firebase": "dstaley",
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**/*.#(js|css)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31536000"
}
]
},
{
"source": "**/*.#(js|css|html)",
"headers": [
{
"key": "Last-Modified",
"value": "Thu, 28 Aug 2014 16:25:05 GMT"
}
]
}
]
}
The file looks properly formatted, and the permission_denied error leads me to believe that it's not possible to set the Last-Modified header with Firebase hosting. Any ideas?
As explained in the documentation:
We currently only support the Cache-Control and the
Access-Control-Allow-Origin headers as a key.
So no, you can't (currently) do that.