PWA 功能在 NGINX 上的 Angular 应用程序中不起作用

问题描述

我正在尝试让我的服务工作者处理我的 Angular 8 应用程序,该应用程序在 Nginx 上作为静态 SPA 托管。在看到在本地主机上运行的功能后,但不是在这里,我被卡住了,因为我可以看到数据被缓存在缓存存储中,但在离线时没有响应。

Under installability it shows that there is no service worker detected but if go to service workers it shows as there is one

Service Worker tab showing the service worker is registered

我的应用程序所在的文件夹结构如下:

我在几个答案中看到他们提到向 mime.types 文件和 default.conf 文件添加一些配置。另外,我看到需要修改清单文件中的范围。我会提到下面的链接,我已经尝试过这些但没有成功,我不确定是否还有其他我应该看的东西,或者我是否应该以特定方式尝试这些,或者是否有特定方式用于 Angular + Nginx

目前manifest中的作用域是'/',start_url是'/myapp'

Configure nginx to serve manifest.json

Angular PWA in IIS subfolder not work offline

Angular service worker with @angular/pwa package showing `HTTP error 504` when offline

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)