Skip to content

tomsvogel/fastify-https-redirect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastify-https-redirect

A plugin for Fastify that adds support for http => https redirects.

Example

npm install fastify-https-redirect
const server = Fastify({
    http2: true,
    https: {
      allowHTTP1: true,
      key: fs.readFileSync(path.resolve(__dirname, './yourSSL.key')),
      cert: fs.readFileSync(path.resolve(__dirname, './yourSSL.cert')),
    },
  });
server.register(httpsRedirect);

With custom http Port

const server = Fastify({
    http2: true,
    https: {
      allowHTTP1: true,
      key: fs.readFileSync(path.resolve(__dirname, './yourSSL.key')),
      cert: fs.readFileSync(path.resolve(__dirname, './yourSSL.cert')),
    },
  });
server.register(httpsRedirect, {httpPort:1080});

With custom http Port and https redirect Port

server.register(httpsRedirect,{httpPort:1080, httpsPort:10443});

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published