Files
freeCodeCamp/curriculum/challenges/english/09-information-security/information-security-with-helmetjs/disable-client-side-caching-with-helmet.nocache.md
Tom 7ce85a8f03 fix(learn): update helmet and bcrypt instructions so we can remove them from boilerplates (#39954)
* fix: update helmet and bcrypt lesson instructions

* fix: update instrutions I missed

* Update curriculum/challenges/english/09-information-security/information-security-with-helmetjs/install-and-require-helmet.md

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>

* Update curriculum/challenges/english/09-information-security/information-security-with-helmetjs/understand-bcrypt-hashes.md

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>

Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
2020-11-04 19:11:36 -08:00

1.5 KiB
Raw Blame History

id, title, challengeType, forumTopicId
id title challengeType forumTopicId
587d8249367417b2b2512c3e Disable Client-Side Caching with helmet.noCache() 2 301576

Description

As a reminder, this project is being built upon the following starter project on Repl.it, or cloned from GitHub. If you are releasing an update for your website, and you want the users to always download the newer version, you can (try to) disable caching on clients browser. It can be useful in development too. Caching has performance benefits, which you will lose, so only use this option when there is a real need.

Instructions

Use the helmet.noCache() method on your server.

Tests

tests:
  - text: helmet.noCache() middleware should be mounted correctly
    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

/**
  Backend challenges don't need solutions, 
  because they would need to be tested against a full working project. 
  Please check our contributing guidelines to learn more.
*/