heroku react appcache 文件导致无限循环

heroku react appcache file causes infinite loop

我正在使用我从 https://github.com/mxstbr/react-boilerplate

开始的 React 应用程序

在浏览器中添加 url 时出现 heroku 正在创建一个无限循环并越来越多地将 appcache 添加到 url 直到导致它在路径中出现多次.示例:2016-06-02T01:24:50.026167+00:00 heroku[router]: at=info method=GET path="/n/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/appcache/manifest.html" host=url-staging-web.herokuapp.com request_id=a2487d47-0290-4ba2-84cf-89724d6a1f0c fwd="199.21.85.8" dyno=web.1 connect=1ms service=3ms status=200 bytes=1018

 2016-06-01T11:55:25.207312+00:00 heroku[router]: at=info method=GET path="/main.598a2e8a565fe386c390.js" host=url-staging-web.herokuapp.com request_id=38da5e86-da9e-4d39-a5bf-aa6214a385a7 fwd="199.21.85.8" dyno=web.1 connect=0ms service=4ms status=304 bytes=239
    2016-06-01T11:55:25.203874+00:00 heroku[router]: at=info method=GET path="/main.7b77c3177cbc4b4b77cac63e87f9d891.css" host=url-staging-web.herokuapp.com request_id=7964b3d5-bd2a-43aa-ac40-81947a2b75d3 fwd="199.21.85.8" dyno=web.1 connect=1ms service=5ms status=304 bytes=237
    2016-06-01T11:55:25.279982+00:00 heroku[router]: at=info method=GET path="/common.js.2758861beb0dd3750ba7.js" host=url-staging-web.herokuapp.com request_id=1653719a-0632-4e50-907a-d49b54d3c1da fwd="199.21.85.8" dyno=web.1 connect=29ms service=24ms status=304 bytes=237
    2016-06-01T11:55:25.408913+00:00 heroku[router]: at=info method=GET path="/3.b632e03fde1e6d398277.chunk.js" host=url-staging-web.herokuapp.com request_id=1f1e897d-b4d8-48d6-bbcf-22975e1ea3d2 fwd="199.21.85.8" dyno=web.1 connect=1ms service=6ms status=304 bytes=237
    2016-06-01T11:55:25.494888+00:00 heroku[router]: at=info method=GET path="/7ed88ecba65877210015036ac001b02a.jpg" host=url-staging-web.herokuapp.com request_id=98e613b4-e959-49c0-b544-3e52701ffdb1 fwd="199.21.85.8" dyno=web.1 connect=1ms service=3ms status=304 bytes=240
    2016-06-01T11:55:25.586825+00:00 heroku[router]: at=info method=GET path="/n/appcache/appcache/appcache/appcache/manifest.html" host=url-staging-web.herokuapp.com request_id=6b9b0ed6-758e-4429-9526-62052c4c927b fwd="199.21.85.8" dyno=web.1 connect=1ms service=4ms status=200 bytes=1018
    2016-06-01T11:55:25.674844+00:00 heroku[router]: at=info method=GET path="/main.7b77c3177cbc4b4b77cac63e87f9d891.css" host=url-staging-web.herokuapp.com request_id=6448bbab-3cb0-4c82-a331-5786727d444e fwd="199.21.85.8" dyno=web.1 connect=1ms service=2ms status=304 bytes=237
    2016-06-01T11:55:25.678774+00:00 heroku[router]: at=info method=GET path="/main.598a2e8a565fe386c390.js" host=url-staging-web.herokuapp.com request_id=969f2169-5779-4d8c-918e-1d0c9ccb6cfe fwd="199.21.85.8" dyno=web.1 connect=0ms service=2ms status=304 bytes=239
    2016-06-01T11:55:25.742839+00:00 heroku[router]: at=info method=GET path="/common.js.2758861beb0dd3750ba7.js" host=url-staging-web.herokuapp.com request_id=3a002083-3d28-4d66-978a-ddd9b4627698 fwd="199.21.85.8" dyno=web.1 connect=22ms service=27ms status=304 bytes=237
    2016-06-01T11:55:25.862540+00:00 heroku[router]: at=info method=GET path="/3.b632e03fde1e6d398277.chunk.js" host=url-staging-web.herokuapp.com request_id=4527bac9-940d-4dbc-941a-ac7a12c706f4 fwd="199.21.85.8" dyno=web.1 connect=1ms service=3ms status=304 bytes=237
    2016-06-01T11:55:25.948453+00:00 heroku[router]: at=info method=GET path="/7ed88ecba65877210015036ac001b02a.jpg" host=url-staging-web.herokuapp.com request_id=d59cb902-76ba-480f-b351-b803f5aaca0e fwd="199.21.85.8" dyno=web.1 connect=1ms service=4ms status=304 bytes=240
    2016-06-01T11:55:26.044044+00:00 heroku[router]: at=info method=GET path="/n/appcache/appcache/appcache/appcache/appcache/manifest.html" host=url-staging-web.herokuapp.com request_id=edaa6df4-3bfa-4cad-aa70-f20bbf0a917c fwd="199.21.85.8" dyno=web.1 connect=1ms service=4ms status=200 bytes=1018
    2016-06-01T11:55:26.131121+00:00 heroku[router]: at=info method=GET path="/main.7b77c3177cbc4b4b77cac63e87f9d891.css" host=url-staging-web.herokuapp.com request_id=f2018b0c-5d8c-4d26-9b8f-f11987842d23 fwd="199.21.85.8" dyno=web.1 connect=1ms service=2ms status=304 bytes=237
    2016-06-01T11:55:26.135145+00:00 heroku[router]: at=info method=GET path="/main.598a2e8a565fe386c390.js" host=url-staging-web.herokuapp.com request_id=1ba60ddf-1037-4132-9925-493f66a4847c fwd="199.21.85.8" dyno=web.1 connect=0ms service=1ms status=304 bytes=239
    2016-06-01T11:55:26.187981+00:00 heroku[router]: at=info method=GET path="/common.js.2758861beb0dd3750ba7.js" host=url-staging-web.herokuapp.com request_id=e0eb2115-8e30-4bd0-b93e-f4d4214d03ad fwd="199.21.85.8" dyno=web.1 connect=18ms service=21ms status=304 bytes=237
    2016-06-01T11:55:26.309497+00:00 heroku[router]: at=info method=GET path="/3.b632e03fde1e6d398277.chunk.js" host=url-staging-web.herokuapp.com request_id=dc4ab1cd-fbf2-4b03-bb91-2711c8c143c7 fwd="199.21.85.8" dyno=web.1 connect=2ms service=3ms status=304 bytes=237
    2016-06-01T11:55:26.394030+00:00 heroku[router]: at=info method=GET path="/7ed88ecba65877210015036ac001b02a.jpg" host=url-staging-web.herokuapp.com request_id=7ea2a7db-a6ed-4971-9b4c-39c38021cdfe fwd="199.21.85.8" dyno=web.1 connect=1ms service=2ms status=304 bytes=240

更新: 好的,我发现它只会导致 http 的无限循环,而不是 https 的无限循环。诡异的? 在 safari 上,无论是 http 还是 https

都会发生

我似乎已经通过关闭 appcache 修复了它。

我查了 appcache 和 MDN 说它不应该再使用了 https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache

所以在 internals/webpack/webpack.prod.babel.js 的离线插件配置中我添加了 appcache: false

new OfflinePlugin({
  relativePaths: true, // Use generated relative paths by default
  // No need to cache .htaccess. See http://mxs.is/googmp,
  // this is applied before any match in `caches` section
  excludes: ['.htaccess'],
  AppCache: false,

  caches: {
    main: [':rest:'],

    // All chunks marked as `additional`, loaded after main section
    // and do not prevent SW to install. Change to `optional` if
    // do not want them to be preloaded at all (cached only when first loaded)
    additional: ['*.chunk.js'],
  },
}),