-
I'm trying to serve my apple-app-site-association using the next server. I place the file in the public folder but rather than it being served, it gets downloaded. Is there a way to serve it without using a custom server? I'm assuming this is down to the fact that there is no file extension so the next-server doesn't know what content type to add to the header, so it defaults to document. Is there a way to change the headers, or another way to serve this. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 17 replies
-
Next.js uses the extension to automatically detect the If Apple requires specific headers, you can overwrite this type: // next.config.js
module.exports = {
experimental: {
headers() {
return [
{
source: "/.well-known/apple-app-site-association",
headers: [{ key: "content-type", value: "application/json" }]
}
];
}
}
}; |
Beta Was this translation helpful? Give feedback.
-
Using next.js 9.5, it can be achieved in 2 steps:
The browser will now render the apple-app-site-association as json without downloading it. Can also be verified by doing this command within the terminal: |
Beta Was this translation helpful? Give feedback.
-
Is there any plan to support |
Beta Was this translation helpful? Give feedback.
Next.js uses the extension to automatically detect the
content-type
of the file. Since the file is extensionless, it's served as binary content—this should be compatible with Apple's verification.If Apple requires specific headers, you can overwrite this type: