How to add Apple App Associations to React App

1.2k Views Asked by At

I'm using react-router-dom in my project as follows to define routes in my React application.

return (
        <Router>
            <Switch>
                <Route path="/join-us" component={BusinessFeatures} />
                <Route
                    path="/signIn"
                    component={SignIn}
                />
                ...some more routes
                <Route path="/">
                    <HomePage />
                </Route>
            </Switch>
        </Router>
    );

Now I would like to add a new route for deep linking to the iOS application associated with my website - the path has to be /apple-app-site-association and the endpoint is supposed to return JSON - here is an example from Reddit: https://www.reddit.com/apple-app-site-association

I'm not sure how I can achieve this using my current setup though, I don't want to define a React component for this, as I want to return a pure JSON response only.

1

There are 1 best solutions below

0
On

I had the same issue and later figured out that the solution is not at all related to React but rather an Nginx configuration.

Sharing the link to my answer- How to serve apple-app-site-association file on /apple-app-site-association page in ReactJS