Search code examples
githubhttpsgithub-pagesdeep-linkingios-universal-links

Set header as application/json Github Pages


I have a simple html website on Github pages for which I want to include the apple-required file apple-app-site-association to verified my domain, such file has no extension, but the content type has to be application/json.

Here's what's inside the file:

{
   "webcredentials": {
      "apps": ["YOUR_TEAM_ID.BUNDLE_IDENTIFIER.app"]
   }
}

Here's the path:

https://<<mydomain>>/.well-known/apple-app-site-association

After validating the file I see:

enter image description here

Normally I would do this in nginx, but since the website is hosted using Github pages and has no proxy associated to it, how can I do this?

pd: I'm also using Cloudflare, I don't know if there is an option for this using this service.

Thank you


Solution

  • I figured out how to do it with Cloudflare, however if someone knows how this can be done within Github, please add the answer.

    Github Pages + Cloudflare solution

    1. Go to Rules and add a new Response Header Modification enter image description here

    2. This is how the rule looks:

    enter image description here