应用程序缓存和404/500 页
我有一个看起来像这样的清单:
CACHE MANIFEST
# e4a75fb378cb627a0d51a80c1cc5684c2d918d93e267f5854a511aa3c8db5b1a
/a/application.js
/a/application.css
NETWORK:
*
FALLBACK:
/ /offline/redirect
问题是我的 /404.html 和 /500.html 页面(显然提供了 404 和 500 的响应代码)正在触发回退。它们的行为就像服务器离线一样。
我的问题有两个:
- 为什么 /404.html 会触发回退,而 /events 不会?
- 如何允许 /404.html 和 /500.html 不触发回退,同时仍然允许 /
触发它。
对于它的价值,我已经尝试过:
NETWORK:
*
/404.html
/500.html
...但是,由于这些页面使用非 200 响应代码提供服务,因此它会触发应用程序缓存错误回调,并且不会保存缓存。
谢谢!
I have a manifest that looks somethin like this:
CACHE MANIFEST
# e4a75fb378cb627a0d51a80c1cc5684c2d918d93e267f5854a511aa3c8db5b1a
/a/application.js
/a/application.css
NETWORK:
*
FALLBACK:
/ /offline/redirect
The issue is that my /404.html and /500.html pages (that are obviously served up with a response code of 404 and 500) are triggering the fallback. They both act just as if the server is offline.
My question is twofold:
- Why does /404.html trigger the fallback when /events doesn't?
- How can I allow /404.html and /500.html to not trigger the fallback while still allowing / to
trigger it.
For what it's worth, I've already tried this:
NETWORK:
*
/404.html
/500.html
... however since those pages are served w/ a non-200 response code, it triggers the app cache error callback and the cache isn't saved.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对我有用的方法:
因此,使用上面的示例:
/teams/1241231
302 重定向到/404.html
,它返回 404 状态代码。What worked for me:
So using the example above:
/teams/1241231
302 redirect to/404.html
which returns a 404 status code.