uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
8.08k stars 574 forks source link

Redirect http to https #774

Closed Wyzix33 closed 2 years ago

Wyzix33 commented 2 years ago

Hi, how can i redirect http to https I have this setup:

 APP = uWS
  .SSLApp({ key_file_name: './privkey.pem', cert_file_name: './fullchain.pem' })
  .any('/*', processRequest)
  .listen(443, (token) => {
   if (token) console.log('Listening to port 443' );
   else console.log('Failed to listen to port 443');
  });

do i need to start another instance of uWS on port 80 and respond with a redirect or is there another way? Thanks

e3dio commented 2 years ago

Port 80 redirect with Location header, same as every other server