Spring Boot redirect HTTP to HTTPS

For Tomcat to perform a redirect, you need to configure it with one or more security constraints. You can do this by post-processing the Context using a TomcatEmbeddedServletContainerFactory subclass. For example: TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() { @Override protected void postProcessContext(Context context) { SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.setUserConstraint(“CONFIDENTIAL”); SecurityCollection collection = new SecurityCollection(); collection.addPattern(“/*”); … Read more

How to use HTTPS in an ASP.Net Application

First get or create a certificate Get the SecureWebPageModule module from http://www.codeproject.com/Articles/7206/Switching-Between-HTTP-and-HTTPS-Automatically-Ver. Instructions for setup can be found in the article. Add secureWebPages tag to web.config <configuration> … <secureWebPages enabled=”true”> … </secureWebPages> … <system.web> … </system.web> </configuration> Add files and directories to be use for https protocol: <secureWebPages enabled=”true”> <file path=”Login.aspx” /> <file path=”Admin/Calendar.aspx” ignore=”True” … Read more

How can I get LWP to validate SSL server certificates?

This long-standing security hole has finally been fixed in version 6.00 of libwww-perl. Starting with that version, by default LWP::UserAgent verifies that HTTPS servers present a valid certificate matching the expected hostname (unless $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} is set to a false value or, for backwards compatibility if that variable is not set at all, either $ENV{HTTPS_CA_FILE} or … Read more

how to use async await with https post request

Basically, you can write a function which will return a Promise and then you can use async/await with that function. Please see below: const https = require(‘https’) const data = JSON.stringify({ todo: ‘Buy the milk’ }); const options = { hostname: ‘flaviocopes.com’, port: 443, path: ‘/todos’, method: ‘POST’, headers: { ‘Content-Type’: ‘application/json’, ‘Content-Length’: data.length }, … Read more

HTTPS connection Python

Python 2.x: docs.python.org/2/library/httplib.html: Note: HTTPS support is only available if the socket module was compiled with SSL support. Python 3.x: docs.python.org/3/library/http.client.html: Note HTTPS support is only available if Python was compiled with SSL support (through the ssl module). #!/usr/bin/env python import httplib c = httplib.HTTPSConnection(“ccc.de”) c.request(“GET”, “https://stackoverflow.com/”) response = c.getresponse() print response.status, response.reason data = … Read more

Using Keycloak behind a reverse proxy: Could not open Admin loginpage because mixed Content

This sounds somehow like a duplicate of Keycloak Docker behind loadbalancer with https fails Set the request headers X-Forwarded-For and X-Forwarded-Proto in nginx. Then you have to configure Keycloak (Wildfly, Undertow) to work together with the SSL terminating reverse proxy (aka load balancer). See http://www.keycloak.org/docs/latest/server_installation/index.html#_setting-up-a-load-balancer-or-proxy for a detailed description. The point is that nginx is … Read more

How can I provide a SSL certificate with create-react-app?

I was able to get a local certificate working without modifying the webpack-dev-server files using react-scripts 3.4.1 (technically added in 3.4.0 but I had some—probably unrelated—issues). I added these two environment variables to my .env.development: SSL_CRT_FILE=.cert/server.crt SSL_KEY_FILE=.cert/server.key Notes: .cert is a folder I created in the root of my project My script that generates the … Read more