--- id: 587d8248367417b2b2512c3d title: Disable DNS Prefetching with helmet.dnsPrefetchControl() challengeType: 2 forumTopicId: 301577 --- ## Description
As a reminder, this project is being built upon the following starter project on Glitch, or cloned from GitHub. To improve performance, most browsers prefetch DNS records for the links in a page. In that way the destination ip is already known when the user clicks on a link. This may lead to over-use of the DNS service (if you own a big website, visited by millions peopleā€¦), privacy issues (one eavesdropper could infer that you are on a certain page), or page statistics alteration (some links may appear visited even if they are not). If you have high security needs you can disable DNS prefetching, at the cost of a performance penalty.
## Instructions
## Tests
```yml tests: - text: helmet.dnsPrefetchControl() middleware should be mounted correctly testString: getUserInput => $.get(getUserInput('url') + '/_api/app-info').then(data => { assert.include(data.appStack, 'dnsPrefetchControl'); assert.equal(data.headers['x-dns-prefetch-control'], 'off'); }, xhr => { throw new Error(xhr.responseText); }) ```
## Challenge Seed
## Solution
```js /** 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. */ ```