Skip to content

Serving Static Files without a file extension, prevent download? #10648

Answered by Timer
maitham asked this question in Help
Discussion options

You must be logged in to vote

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:

// next.config.js
module.exports = {
  experimental: {
    headers() {
      return [
        {
          source: "/.well-known/apple-app-site-association",
          headers: [{ key: "content-type", value: "application/json" }]
        }
      ];
    }
  }
};

Replies: 3 comments 17 replies

Comment options

You must be logged in to vote
5 replies
@maitham
Comment options

@ijjk
Comment options

ijjk Feb 29, 2020
Maintainer

@maitham
Comment options

@mhtamun
Comment options

@ekimcem
Comment options

Answer selected by Timer
Comment options

You must be logged in to vote
12 replies
@aliosmanerkan
Comment options

@peter-stuart-turner
Comment options

@bas080
Comment options

@peter-stuart-turner
Comment options

@meetmakwana7396
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet