所以我的设置如下:
https://sub.domain.com/folder/
处部署的静态网站(mkdocs)。>>localhost:port
本地测试,没有子域和文件夹。<link rel="manifest" type="application/manifest+json" href="manifest.json" crossorigin="use-credentials">
,文件处于部署状态,处于/folder/
,在本地测试的根目录中。<script type="text/javascript" src="sw.js"></script>
,文件处于部署状态,处于/folder/
,在本地测试的根目录中。assets/icons/icon.png
,处于部署状态的assets
处于/folder/
,在本地测试的根中。图标在本地有效,但是在已部署的站点上,我得到:
Icon https://sub.domain.com/folder/assets/icons/icon.png failed to load
当我直接转到该URL时,文件加载就很好了。
该站点位于auth后面,但是在加载清单时使用crossorigin="use-credentials"
。>
Full manifest.json:
{ "short_name": "Site Hub", "name": "Site Hub", "start_url": "/docs/?utm_source=web_app_manifest", "icons": [ { "src": "assets/icons/manifest-icon-192.png", "sizes": "192x192", "type": "image/png" }, { "src": "assets/icons/manifest-icon-512.png", "sizes": "512x512", "type": "image/png" } ], "display": "standalone", "orientation": "portrait", "theme_color": "#20232A", "background_color": "#20232A" }
我之前尝试过类似
./assets/icons/manifest-icon-512.png"
的路径,但也没有用。
因此,我的设置如下:在Kestrel上运行的静态网站(mkdocs)部署在Azure Blob存储中的https://sub.domain.com/folder/上。在本地主机上进行测试:不带子域的本地主机和端口,...
您可能应该在package.json中使用homepage选项,以使应用知道它已部署在https://sub.domain.com/folder。
喜欢这个: