freeCodeCamp/curriculum/challenges/chinese/06-information-security-and.../information-security-with-h.../disable-client-side-caching...

1.4 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d8249367417b2b2512c3e Disable Client-Side Caching with helmet.noCache() 2 使用helmet.noCache禁用客户端缓存

Description

提醒一下,这个项目是基于Glitch的以下入门项目构建的,或者是从GitHub克隆的。如果您要为您的网站发布更新,并且您希望用户始终下载较新的版本,您可以(尝试)在客户端的浏览器上禁用缓存。它在开发中也很有用。缓存具有性能优势,您将失去这些优势,因此只有在真正需要时才使用此选项。

Instructions

Tests

tests:
  - text: 应该正确安装helmet.noCache中间件
    testString: 'getUserInput => $.get(getUserInput("url") + "/_api/app-info").then(data => { assert.include(data.appStack, "nocache"); assert.equal(data.headers["cache-control"], "no-store, no-cache, must-revalidate, proxy-revalidate"); }, xhr => { throw new Error(xhr.responseText); })'

Challenge Seed

Solution

// solution required