BackendStack21/fast-gateway

Force SSL not working

Closed this issue · 5 comments

I am trying to implement forcedomain npm in fast-gateway but it is not working. I even checked my port 443 but it is not redirecting to https. Can you please check and let us know what is the issue?

Just used the sample code to get started:

require('dotenv').config();
const gateway = require('fast-gateway')
const PORT = process.env.PORT || 9090

const service = gateway({
  middlewares: [
    require('cors')(),
    require('helmet')(),
    forceDomain({
      hostname: '192.168.X.XXX',
      port: PORT,
      protocol: 'https'
    })
  ],
  // Can add routes here!
  routes: [{
    prefix: '/verify',
    target: process.env.VERIFICATION_API
  }]
});

service.start(PORT).then(server => {
  	console.log(`API Gateway listening on ${PORT} port!`)
})

Hi @rajkumarpb, thanks for reaching out.

I am not too familiar with the forceDomain middleware, but I guess you are using the same port for the redirection and for the gateway.
In that case, the gateway is not using SSL...

Hi @rajkumarpb, any followup on this?

I have changed the ports for gateway and redirection but still not working. Getting the same error.

Hi @rajkumarpb , could you please paste here the complete source code of your setup, a minimum equivalent example would work. So I can try to repro on my side.

Regards

What I have posted in original post is the complete source which I'm using and getting this issue. With that code itself you can emulate this issue.

Hi @rajkumarpb , could you please paste here the complete source code of your setup, a minimum equivalent example would work. So I can try to repro on my side.

Regards