BackendStack21/fast-gateway

run fast-gateway on https

Closed this issue · 1 comments

Is it possible to run fast-gateway on https? I have an Angular 12 frontend with ssl certificate as well as microservices running as https but i get issues when an https request is sent from the frontend to the api gateway. How do i go about this?

My frontend is setup as:

 "ssl": true,
 "sslKey": "../../servers/certificates/key.key",
  "sslCert": "../../servers/certificates/cert.crt"

My microservices are setup as:

  if (NODE_ENV === 'prod') {
    const options = {
      key: fs.readFileSync('../certificates/key.key'),
      cert: fs.readFileSync('../certificates/cert.crt')
    };

    https.createServer(options, app).listen(config.port, (error) => {
      if (error) {
        return console.log(chalk.red(error));
      }
      return console.log(
        chalk.green(`Running ${config.api_title} on ${config.hostname}:${config.port}`)
      );
    });
  }

Hi @codezilla91 , thanks for reaching out. fast-gateway uses https://www.npmjs.com/package/fast-proxy-lite by default to connect with origin servers using HTTP or HTTPS. The proxy library will automatically switch to https Agent when the target starts with "https:// ...".
In case you need to support self-signed certs, you can use rejectUnauthorized = false in proxyConfig of your route. Please see: https://fgw.21no.de/#/?id=configuration-options-explained

Best Regards