Create a proxy to redirect http requests to https using nodejs

Hi Guys,

I am new to a Node.js developer. I want to create a proxy server that redirects http requests to https. lets say my system IP is (open port ) my public IP is yyy.yy.yyy.yy ( opened port is port2) I have bound my public IP to a test domain.

I am writing a node.js program that redirects http calls to https. I have found http-proxy-middleware npm that has methods to do this.

var express = require('express')
var proxy =  require('http-proxy-middleware');
const fs= require('fs');

var proxyServer = proxy({
  target: '',
  port: port2,
  changeOrigin: true, 
  cert: fs.readFileSync('certificate.crt'),

var app = express()

app.use('*',  proxyServer)



the certificate is in the same dir. a server is running on port1 on my system

Now, this redirects to the https URL but I get this error Your connection is not private. Apparently, SSL certification failed or some other issue.

Please point out what I am doing wrong and what could be a possible solution.

Thanks & Regards

Nice Article!

Thanks for sharing with us :slightly_smiling_face:

mulesoft training in hyderabad

Nice Article!

Thanks for sharing with us :slightly_smiling_face:

Azure Admin Interview Questions

Nice Article!

Thanks for sharing with us :slightly_smiling_face:

ADF Interview Questions

[Mulemasters is a software training and placement company that provides training on MuleSoft, an integration platform as a service (iPaaS) solution. They offer both online and classroom training, and their courses are designed to help students learn the skills they need to become MuleSoft certified.

Mulemasters was founded in 2015 by two software engineers who saw the need for better training on MuleSoft. They have since trained over 10,000 students, and their courses have been rated highly by students and employers alike.mule

ServiceNow Training

ServiceNow is a cloud-based platform that helps organizations manage their IT services, customer service, and other business processes. It is a complex platform with a wide range of features, so it is important to have proper training before using it.

There are many different types of ServiceNow training available, including:

  • Foundation courses: These courses provide an overview of the ServiceNow platform and its key features. They are ideal for beginners or for people who need to refresh their knowledge.
  • Role-based courses: These courses focus on the specific tasks that people in different roles need to perform in ServiceNow. For example, there are courses for IT administrators, customer service representatives, and project managers.
  • Certification courses: These courses prepare people for ServiceNow certifications, such as the Certified ServiceNow Administrator (CSA) and Certified ServiceNow Application Developer (CAD).

servicenow training

Nice Article
Thanks for sharing with us :slightly_smiling_face:
Dental Clinic in Manikonda