next.js: apple-app-site-association static file is triggering dynamic routing
Bug report
Describe the bug
In our /public folder we have a file called apple-app-site-association
that is used for deep linking with iOS, etc.
We also have a dynamic route setup that looks like this /[slug]/[id]
When on an iOS device safari looks for this static file apple-app-site-association
but for some reason it’s still triggering Next.js routing. This is then causing the slug to be apple-app-site-association
and trying to then make an API call with that filename value as the string.
We’ve recently upgraded to the latest version of Next.js and it has only recently happened since upgrading.
To Reproduce
Place an apple-app-site-association
file at /public, create a dynamic route like /[slug]/[id] watch for apple-app-site-association
to show up in getInitialProps context.
Expected behavior
This file should be ignored within the routing scope like it was previously.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (12 by maintainers)
Commits related to this issue
- add: aasa 추가 - 앱클립 테스트를 위한 AASA - https://github.com/vercel/next.js/issues/14047 — committed to qbbang/NotionBlog by qbbang 3 years ago
I had this issue too. I was able to solve this on Vercel with 2 steps:
./well-known
instead of at the root.vercel.json
file that specifies the headerContent-Type: application/json
.With these 2 things together I was able to resolve the 308 Permanent redirect issue and avoid having the file download to my machine.
Apple will be fine with the file downloading to your machine though, it’s just not ideal when you’re testing it.
Is there some pre-req for this solution. It doesn’t seem to be working for me. Still getting content-type as application/octet-stream.
@kylemcd As a temporary fix, it looks like
apple-app-site-association
can be placed in a.well-known
subdirectory, so perhaps movingapple-app-site-association
to/public/.well-known
would fix your issue?I do think it’d be better for dynamic routing to check the
public
folder first, though, so let’s see what I can find…