Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run scanservjs in ssl #706

Open
piyushgarg opened this issue Dec 7, 2023 · 1 comment
Open

run scanservjs in ssl #706

piyushgarg opened this issue Dec 7, 2023 · 1 comment

Comments

@piyushgarg
Copy link

This is more of a documentation point to be added as I was not able to find how to run scanserv in https/ssl certificate. Not very good at node paradigm, so please change.
Edit server.js

#!/usr/bin/env node

const fs = require('fs');
const https = require('https')
const options = {
        cert: fs.readFileSync('/usr/lib/scanservjs/config/fullchain.pem'),
        key: fs.readFileSync('/usr/lib/scanservjs/config/privkey.pem')
};

const express = require('express');
const application = require('./application');
const ExpressConfigurer = require('./express-configurer');
const config = application.config();
const app = express();

ExpressConfigurer.with(app)
  .encoding()
  .statics()
  .basicAuth()
  .swagger()
  .endpoints();

const sslServer = https.createServer(options, app);
        sslServer.listen(config.port, () => {
})

sslServer.setTimeout(config.timeout);
@Leone25
Copy link

Leone25 commented Jan 6, 2024

it'd be probably better to just use a reverse proxy like nginx for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants