Skip to content

Instantly share code, notes, and snippets.

@mbleigh
Created August 2, 2016 18:42
Show Gist options
  • Save mbleigh/c9140c97a342b9d2e7cd727e21b6268f to your computer and use it in GitHub Desktop.
Save mbleigh/c9140c97a342b9d2e7cd727e21b6268f to your computer and use it in GitHub Desktop.
Firebase Hosting for apple-app-site-association
{
"hosting": {
"headers": [
{
"source": "/.well-known/apple-app-site-association",
"headers": [{"key": "Content-Type", "value": "application/json"}]
}
]
}
}
@RanoshTarek
Copy link

I hosted the website in the default domain
then I created another domain
I use the other domain to handle my deep link which works fine on Android but ios, not
ios open the preview screen then redirect to the hosted website (default domain) expected to open ios app like android
firebase.json
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"/.*",
"
/node_modules/"
],
"headers": [
{
"source": "/.well-known/apple-app-site-association",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
},
{
"source": "apple-app-site-association",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
]
}
],
"appAssociation": "NONE",
"rewrites": [
{
"source": "
",
"dynamicLinks": true
},
{
"source": "/",
"dynamicLinks": true
},
{
"source": "/links/
",
"dynamicLinks": true
},
{
"source": "/sina-app.com/",
"dynamicLinks": true
},
{
"source": "https://sina-app.com/
",
"dynamicLinks": true
},
{
"source": "sina-app.com/**",
"dynamicLinks": true
},
{
"source": "sina-app.com/*",
"dynamicLinks": true
}
]
}
}

@dleurs
Copy link

dleurs commented Jan 24, 2024

SOLVED my folder was .well_known instead of .well-known

I don't know why I am getting content-type: text/plain; charset=utf-8 when curl -i https://destrompesetvous-b6900.web.app/.well_known/apple-app-site-association

I also placed apple-app-site-association inside root and here it is working, I am getting content-type: application/json when curl -i https://destrompesetvous-b6900.web.app/apple-app-site-association

firebase.json

{
  "hosting": {
    "public": "build/web",
    "headers": [
      {
        "source": "/.well-known/apple-app-site-association",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ]
      },
      {
        "source": "/apple-app-site-association",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ]
      },
      {
        "source": "/.well-known/assetlinks.json",
        "headers": [
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ]
      }
    ],
    "appAssociation": "NONE"
  }
}

apple-app-site-association and .well_known/apple-app-site-association

{
  "webcredentials":{
     "apps":[
        "JJS627SP9W.fr.trompe.appli"
     ]
  },
  "applinks":{
     "details":[
        {
           "appID":"JJS627SP9W.fr.trompe.appli",
           "paths":[
              "*"
           ],
           "appIDs":[
              "JJS627SP9W.fr.trompe.appli"
           ],
           "components":[
              {
                 "/":"/*"
              }
           ]
        }
     ]
  }
}

And tried adding rewrites rules without success

"rewrites": [ {
      "source": "/.well-known/apple-app-site-association",
      "destination": "/apple-app-site-association"
    } ], 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment