Comments (1)
PWA, 即:Progressive Web App (渐进式Web应用程序);它的存在,使得在网络上提供惊人用户体验的新方式,它为构建高质量的渐进式 Web 应用程序,提供了令人难以置信的优势,可以轻松取悦用户,增加参与度并增加转化次数。所以这已经成为了现代化 Web 应用程序必做工作。本应用对 PWA 的支持,选择参考了 vuejs-templates/pwa,其中用到 sw-precache-webpack-plugin 插件协助生成 service-worker.js
。但在部署到服务器之后,屡次报有如下错误,令人百思不得其解:
The script has an unsupported MIME type ('text/plain').
Failed to load resource: net::ERR_INSECURE_RESPONSE
即便已经将 service-worker.js
放置在根目录之下,应用也支持 HTTPS 等等 serviceWorker 必须条件,且在 node server
层提供了对应用访问 service-worker.js 支持,但屡次尝试,报错依然存在。
后来仔细看了请求发现,地址栏访问 service-worker.js
虽没有问题;但在访问 https://nicelinks.site/ 时候,所发起对 service-worker.js
的请求,竟是失败的;而在 node server 层肯定是 Okay,猛然醒悟,猜测问题可能出现在 nginx
层;立刻查究 nginx 对应用的配置文件,发现果然是有问题的 ——没有针对 js
文件提供映射,😪。
location ~ \.(htm|html|gif|jpg|jpeg|png|bmp|ico|css|txt)$ {
root /data/site/nicelinks/public;
index index.html;
try_files $uri $uri/ =404;
expires 7d;
}
果然改为如下这样,重启 nginx
( nginx -s reload
),问题迎刃而解;
location ~ \.(htm|html|gif|jpg|jpeg|png|bmp|ico|css|txt|js)$ {
root /data/site/nicelinks/public;
index index.html;
try_files $uri $uri/ =404;
expires 7d;
}
from nicelinks-vue-client.
Related Issues (20)
- 更换网站的字体风格
- 优化登录设计 & 体验
- 完善邮件(通知)系统
- 完善系统监控方案
- 优化用户默认头像策略
- 打造评论系统 & 讯息系统
- 定期自动抓取/更新网站首页截图
- 为应用增加 username 登录方式 HOT 1
- 为应用生成站点地图并提交
- 为站点信息添加新的信息项:点评
- 为不同路由动态设置 title, meta, 以提升网站 SEO HOT 1
- 增加并完善对 Markdown 支持
- 切换语言的菜单 HOT 3
- 注入“箴言锦语”功能
- 完善首页展示图片 HOT 1
- 添加在「倾城之链-快应用」中打开入口
- 增加「站内搜索」功能
- 修复 & 增强倾城之链的 SEO
- 为 NICE LINKS 添加相似推荐
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nicelinks-vue-client.