---
title: Make sure your server uses the https protocol
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Make sure your server uses the https protocol
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Make sure your server uses the https protocol

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `typescript-express/https-protocol-missing`

**Language:** TypeScript

**Severity:** Notice

**Category:** Security

**CWE**: [693](https://cwe.mitre.org/data/definitions/693.html)

## Description{% #description %}

Your server should use the HTTPS protocol to receive connections. You may do this by placing an HTTPS reverse proxy in front of your HTTP server, or by using `https.createServer()` instead of `http.createServer()`.

Per [Express documentation](https://expressjs.com/en/advanced/best-practice-security.html#use-tls):

If your app deals with or transmits sensitive data, use [Transport Layer Security](https://en.wikipedia.org/wiki/Transport_Layer_Security) (TLS) to secure the connection and the data. This technology encrypts data before it is sent from the client to the server, thus preventing some common (and easy) hacks.

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```typescript
import http from 'http';
import express, { Express } from 'express';

const app: Express = express();

var httpServer = http.createServer(app)
httpServer.listen(8080);
```

## Compliant Code Examples{% #compliant-code-examples %}

```typescript
import https from 'https';
import fs from 'fs';
import express, { Express } from 'express';

const app: Express = express();

var options = {
  key: fs.readFileSync('path/to/the/key.pem'),
  cert: fs.readFileSync('path/to/the/cert.cert')
};

var httpsServer = https.createServer(options, app)
httpsServer.listen(443);
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 