How do I use a self signed certificate for a HTTPS Node.js server?

Update (Nov 2018): Do you need self-signed certs? Or would real certificates get the job done better? Have you considered any of these? Let’s Encrypt via Greenlock.js Let’s Encrypt via https://greenlock.domains Localhost relay service such as https://telebit.cloud (Note: Let’s Encrypt can also issue certificates to private networks) ScreenCast https://coolaj86.com/articles/how-to-create-a-csr-for-https-tls-ssl-rsa-pems/ Full, Working example creates certificates runs … Read more

How to make python on Heroku https only?

Combining the answer from @CraigKerstiens and @allanlei into something I have tested, and verified to work. Heroku sets the HTTP_X_FORWARDED_PROTO to https when request is ssl, and we can use this to check: from django.conf import settings from django.http import HttpResponseRedirect class SSLMiddleware(object): def process_request(self, request): if not any([settings.DEBUG, request.is_secure(), request.META.get(“HTTP_X_FORWARDED_PROTO”, “”) == ‘https’]): url … Read more

Visual Studio website is redirecting http to https when debugging

I believe this is caused by HSTS – see http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security If you have (developed) any other localhost sites which send a HSTS header… eg. Strict-Transport-Security: max-age=31536000; includeSubDomains; preload …then depending on the value of max-age, future requests to localhost will be required to be served over HTTPS. To get around this, I did the following. … Read more

how to monitor the network on node.js similar to chrome/firefox developer tools?

Use external HTTP Debugging tool. Your options include: node-http-proxy as seen in How do I use node.js http-proxy for logging HTTP traffic in a computer? middlefiddle written in node.js (but abandoned for 3 years now) https://github.com/mdp/middlefiddle mitmproxy – a CLI tool http://mitmproxy.org fiddler http://www.telerik.com/fiddler and many more – https://www.google.pl/search?q=HTTP+debugger You fire up one of those, … Read more

WebClient + HTTPS Issues

The shortest notation of the code to allow all certificates is actually: ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; And works well for this error. Needless to say that you should provide an implementation which actually checks the certificate and decides based on the certificate information if the communication is safe. For test purposes, use … Read more

How to use HTTPS / SSL with Kestrel in ASP.NET Core 2.x?

The basics. Using Server URLs If you want to associate your server to use all the IP addresses assigned to the server/web host then you can do this: WebHost.CreateDefaultBuilder(args) .UseUrls(“http://localhost:5000”, “http://*:80”) .UseStartup<Startup>() .Build(); Note: The string format used in the UseUrls() method is: http://{ip address}:{port number}. – If you use an * (asterisks) for the … Read more