Hosting Apple verification file with NextJS

Total
1
Shares

I’m using NextJS.

As per here, I need to host a file on my app.

Specifically, it needs to be hosted at:

https://app.blah.com/.well-known/apple-developer-merchantid-domain-association

What is the best way to serve this file from that folder? The URL has to be exactly as above.

When I try and put it in a folder at top level called .well-known, it doesn’t work. I suspect because it’s not being served when the app is actually built.

Conversely, localhost/static/apple-developer-merchantid-domain-association works fine if I put the file in there.

So, how can I do what I need to do here?


Solution

Anything in Next.js public folder will become accessible at root. So put the file in /public/.well-known/apple-developer-merchantid-domain-association and it will be accessible at yourdomain.com/.well-known/apple-developer-merchantid-domain-association.

Leave a Reply

Your email address will not be published. Required fields are marked *