question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do you set up SSL?

See original GitHub issue

Is there a way to start the Nest application with SSL cert options so I can have a HTTPS server?

For now I manually call the init() function on the Nest app and start the HTTPS server with express app manually.


let options = {
    key: fs.readFileSync(Config.SSL_KEY_PATH),
    cert: fs.readFileSync(Config.SSL_CERT_PATH)
};

let httpsServer = https.createServer(options, expressApp);

const app = NestFactory.create(ApplicationModule, expressApp);
app.useGlobalPipes(new ValidatorPipe());
app.init();

httpsServer.listen(httpsPort);

I was just wondering if there is any standard way of doing SSL with Nest. Couldn’t find it in the documentation.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
miguelcamposdevcommented, Nov 29, 2018

For me was enough this code in the main.ts:

async function bootstrap() {
  const fs = require('fs');
  const keyFile  = fs.readFileSync(__dirname + '/../ssl/mydomain.com.key.pem');
  const certFile = fs.readFileSync(__dirname + '/../ssl/mydomain.com.crt.pem');

  const app = await NestFactory.create(AppModule, {
    httpsOptions: {
      key: keyFile,
      cert: certFile,
    }});
  
//...
}
0reactions
lock[bot]commented, Sep 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Install an SSL/TLS Certificate In Web Host Manager ...
1. Log in to WHM · 2. Enter Username/Password · 3. Go to your Homepage · 4. Click SSL/TLS · 5. Click Install...
Read more >
SSL Certificate Installation Instructions & Tutorials - DigiCert.com
DigiCert SSL Certificate installation tutorial for Apache, Microsoft IIS, Sun, Novell, & more. Call Toll Free: 1-800-896-7973 for Live Support at No Charge....
Read more >
A Beginner's Guide to SSL: What It is & Why It ... - HubSpot Blog
To set up an EV SSL, you must prove that you are authorized to own the domain you're submitting. This ensures users that...
Read more >
What is an SSL Certificate, and how to install one on your site
An SSL, or Secure Sockets Layer, is one of the most important parts ... they know that your site is a safe one...
Read more >
4 Ways to Install an SSL Certificate - wikiHow
1. Generate a Certificate Signing Request (CSR). Before you can purchase and install an SSL certificate, you will need to generate a CSR...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found