I use HAProxy to do SSL offloading for a WordPress site. Frontend is on 80 and 443 with redirect HAProxy redirect HTTP to HTTPS using
redirect scheme https code 301 if !{ ssl_fc }
Redirection is working well when the page is accessed on port 80.
However the pages loads incomplete and looking in the console of Firefox/Chrome it can be seen that “mixed mode content” is blocked by the browser. Some stylesheets, scripts an images are still accessed over http instead of https.
301 is permanent redirection, so why is this happening? The browser should not even try http because it should be aware of the permanent redirection. And besides that, even when http is used accidentally, it should still be redirect to https instead. Continue reading
May 19 2023
HAProxy mixed content warning when using HTTPS
May 05 2023
HAProxy path-based routing with SSL in http mode with SNI on backend servers
The setup I need to build with HAProxy is the high availability solution consisting of http (http to https redirection must be configured in HAProxy) and https frontends with two backends. Backend servers have HTTPS enabled so HAProxy must establish HTTPS connection to backend servers. We have four backend servers and we want first two servers serve one specific app (
/app
path) and the other two – all other requests so we need path-based routing in HAProxy. In addition, there are multiple domains that must be served by backend servers (and HAProxy).
As we need path-based routing, HAProxy must operate in http mode (on the 7th level) allowing it to examine contents of HTTP headers and extract Host
and Path
headers. Later, the incoming request must be sent to a proper backend based on the Path
header and connection to backend server must be established via HTTPS. As multiple domains must be served by HAProxy and backends we need to install multiple certificates in HAProxy and enable Server Name Indication (SNI) with backend servers.
Here is how configure HAProxy in that way step by step. Continue reading
Apr 26 2023
IIS import error Failed to add duplicate collection element “mysite”
In case you try to import your website configuration on another IIS and get this error message while you don’t have “mysite” deployed on the new IIS it means that there is a website with the same ID already exists on the new IIS. The solution to Failed to add duplicate collection element error in this case is also simple: Continue reading
Apr 26 2023
IIS export import configuration
When using multiple IIS server in a Load Balanced Environment it will be alot of work to create all your website twice with the same settings on each webserver. Therefor it is possible to export and import your configuration from one IIS webserver to the other.
When you create a website in IIS a unique application pool will also be created and used by this website, that’s why you need to import these application pools first on the second webserver before importing the website(s). Continue reading
Apr 19 2023
Terraform set timezone upon virtual machine creation
Sometimes it’s important to set proper timezone on the server and recently I’ve got this task: set proper timezone automatically based on the server’s location in Azure Cloud. Moreover, I needed timezone to be set automatically by Terraform upon virtual machine creation. In my case I had Ubuntu VMs in Azure and here is the simple and elegant solution I came with: Continue reading
Mar 23 2023
How to find unattached Public IPs in Azure
Finding the Unassociated IP Addresses
- Open the Azure Portal.
- Perform a search for Public IP addresses.
- Click on the +Add filter option.
- From the drop-down for Operator, select “==”.
- Select “–” for Value.
- Click Apply.
After you complete these steps, you’ll have a list of unattached Azure public IP addresses. The next phase of the operation involves selecting and deleting the addresses that the system isn’t using for any resources. Continue reading
Feb 20 2023
Publish Code Coverage of .NET app in SonarQube from Azure DevOps
This article enhances the one where I explained the steps of generation and publication code coverage in Azure DevOps pipeline. This time we go further and implement “shift-left” strategy by introducing SonarQube in Azure DevOps CI/CD process. Our task here will be not only configure code analysis in SonarQube but also get code coverage metrics so we can use it in quality gates and follow “clean as you code” principle. Continue reading
Feb 18 2023
Correct Way to Generate and Publish .NET Code Coverage in Azure DevOps
Publishing code coverage in Azure DevOps and making it look pretty is way harder than it should be. It’s something that sounds simple, oh just check the box on the task – but nope you have to make sure to read the notes and add the additional parameter to the test task. Okay great, now you have a code coverage tab, but what is this .coverage file and how do I open it? That’s not very user friendly. And don’t get me started on having to wait for the entire pipeline to finish before you can even see the code coverage tab – nonsensical. Continue reading
Jan 20 2023
How to resolve merge conflicts in Azure DevOps
There is a simple and effective extension that allows resolving Pull Requests merge conflicts directly in Azure DevOps: Pull Request Merge Conflict Extension Continue reading
Jan 19 2023