Serving ./well-known/apple-app-site-association file from pages
I'm using next js's static file export feature and uploading my website to pages (so not using functions). I added apple's universal linking verification file today at next js's
public/.well-known/apple-app-site-association
path. And it does get picked up when I visit the site, however instead of showing contents it gets downloaded.
Apple requires devs to serve this file as json. I added _headers file to public/_headers
location with following contents
And deployed, however it seems to have no effect and file still gets downloaded. Would appreciate any advice on how to resolve this without using functions if possible.2 Replies
If a file is downloaded or displayed in a browser is controlled by https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
Content-Disposition - HTTP | MDN
In a regular HTTP response, the Content-Disposition response header is a header indicating if the content is expected to be displayed inline in the browser, that is, as a Web page or as part of a Web page, or as an attachment, that is downloaded and saved locally.
Yup, you would need to add the following header to the desired path:
Content-Disposition: inline