title: Checkmarx scan - how to fix Missing_HSTS_Header warning?
body: <p>after running Checkmarx scan on my Node.js application, I got a warning of Medium severity -&gt; <strong>Missing_HSTS_Header</strong>. On this piece of code that just returns the content of metadata.json file (highlighted as a source of error is <em>&quot;res.json&quot;</em>).</p>
  <pre><code>const app = express();
  app.get('/metadata', (req, res, next) =&gt; {
      res.json(JSON.parse(fs.readFileSync(path.join(__dirname, 'metadata.json'), 'utf8')));
  });
  </code></pre>
  <p>Initially, it looked like an easy fix. For example, in this link, I found 3 possible solutions - <a href="https://github.com/cloudfoundry-incubator/service-fabrik-broker/issues/445" rel="nofollow noreferrer">https://github.com/cloudfoundry-incubator/service-fabrik-broker/issues/445</a> .</p>
  <p>But the problem is that none of those works. I tried to use helmet, I useds hsts npm package, I did explicitly set hsts code in console with this command.</p>
  <pre><code>res.setHeader(&quot;Strict-Transport-Security&quot;, &quot;max-age=31536000&quot;);
  </code></pre>
  <p>Yet, Checkmarx still complains. Did someone else also experience this? If yes, do you have the idea what could be wrong and why all solutions posted online do not work? Thank you</p>
  <p>EDIT: Here, I found an explicit way in Checkmarx documentation, but the waring keeps appearing - <a href="https://github.com/Checkmarx/JS-SCP/blob/master/src/communication-security/ssl-tls.md" rel="nofollow noreferrer">https://github.com/Checkmarx/JS-SCP/blob/master/src/communication-security/ssl-tls.md</a></p>