reactjsjekyllcreate-react-appgithub-pagesandroid-deep-link

Validating deep links on web app hosting on Github Pages


I have a create-react-app application hosted on GitHub pages, with a custom domain www.example.com.

I need to validate the domain for deep links on Google Play Console, and for that I need to ensure this URL is accessible:

https://www.example.com/.well-known/assetlinks.json

Every file that I have under /public on my app is reachable (e.g. www.example.com/manifest.json). So I created a folder .well-known under /public and put inside assetlinks.json.

However, I always get 404 on https://www.example.com/.well-known/assetlinks.json The problem must be the .well-known folder, since it works well if I put the JSON directly under /public.

I tried adding a file .nojekyll on the root of my project, but still same issue.

Not sure if this is related, but I also have a logic like this, to display a fancy Not Found page when I enter a route that has not been previously defined. <Route path="*" element={} />

So if I enter localhost:3000/asdf it correctly shows my fancy NotFound, but if I enter example.com/asdf it shows instead the GitHub Pages 404.

Any ideas?


Solution

  • I resolved the issue by:

    1. Adding .nojekyll to /public folder instead of the root folder (so that it is present in /build after running npm run build)
    2. Change my deploy script on package.json to "deploy": "gh-pages -b master -d build -t" (I was missing -t)

    Hope it helps other people!