如何在ReactJS的/ apple-app-site-association页面上提供apple-app-site-association文件

问题描述 投票:2回答:1

在ReactJS项目中提供apple-app-site-association文件时遇到很多麻烦。

我已经搜索了很多GitHub问题页面(用于ReactJS,Gatsby和Angular),论坛和许多在线社区,并且似乎找不到解决方案。


我尝试过的是

  • 将文件添加到public /。众所周知的文件夹。
  • 在路径“ / apple-app-site-association”上通过react-router添加单独的路由,并返回带有文件的标签
  • <link rel="apple-app-site-association" href="%PUBLIC_URL%/.well-known/apple-app-site-association">添加到public / index.html

通过"aasa-validator"测试返回:

找不到或未识别您文件的'content-type'标头。


请记住:

  • apple-app-site-association JSON文件不得具有.json文件扩展名。
  • 它必须在网站上的“ / apple-app-site-association”或“ ./well-known/apple-app-site-association”链接上。
  • 我无法使用重定向到另一个页面/链接。

提前感谢!

Ps。如果有帮助,我正在使用Heroku进行部署。

ios reactjs ios-universal-links apple-app-site-associate
1个回答
0
投票

几天过去了,我没有找到答案或解决方案。 (而且我真的很讨厌在寻找解决方案时看到未解决的stackoverflow问题)

我已经与很多人交谈,几乎每个人都说这是不可能的。原因是客户端发送GET请求后,ReactJS无法返回响应的JSON类型。

所以我们将文件传输到了正常工作的后端。

tl; dr 不可能。

© www.soinside.com 2019 - 2024. All rights reserved.