How do you secure your backend using HTTPS? I will create a Swagger Node Project to show you how.
Swagger Module for Node will create an endpoint that looks like this( By default the Swagger Document is available on http://localhost:10010/swagger
).
Now let’s configure the NGINX to send the traffic to my upstream server.
Find your NGINX configuration file. On my Mac it was in /usr/local/etc/nginx/
directory.
Add this configuration to that.
Now stop NGINX and then start it.
Or simply restart it.
You are all set. Hit the endpoint using the browser( I am using a Self Signed Certificate. Therefore the browser will show an invalid cert message.).
Don’t forget to disable HTTP or to enforce HTTP redirection to HTTPS in your Production Environments.