Send additional HTTP headers to Nginx’s FastCGI

It’s not that often that I come across a useful, but undocumented feature in a major software application.  It happened recently, so I’ll document it here just for the future self.

For a particular setup, I had to send additional HTTP headers (let’s use X-GEOIP for this example) to the PHP-FPM, which was configured as a FastCGI backend in Nginx web server.  This StackOverflow thread suggested several solutions, but this one was the easiest and worked like a charm: use Nginx’s fastcgi_param directive AND prefix your variables with HTTP_.  For example:

location ~ \.php$ {
  fastcgi_param HTTP_X_GEOIP $geoip;
  ... other settings
}

 

macOS in the cloud

With the constant expansion of cloud providers and services, one would think everything is possible and easy these days.  Well, at work, we came across an interesting project which shed some light on the lesser discussed areas of cloud providers and services – macOS.

Both Linux and Windows are well suited for the cloud, and are widely covered.  macOS though not so much.  Why?  Well, there are many reasons, but one of them might be that short, but annoying paragraph in the software license agreement (this one is for Catalina, but you can easily check the others here):

J. Other Use Restrictions. The grants set forth in this License do not permit you to, and you agree not to, install, use or run the Apple Software on any non-Apple-branded computer, or to enable others to do so.You agree not to remove, obscure, or alter any proprietary notices (including trademark and copyright notices) that may be affixed to or contained within the Apple Software. Except as otherwise permitted by the terms of this License or otherwise licensed by Apple: (i) only one user may use the Apple Software at a time, and (ii) you may not make the Apple Software available over a network where it could be run or used by multiple computers at the same time. You may not rent, lease, lend, sell, redistribute or sublicense the Apple Software.

Yup.  You have to run Apple software on the Apple hardware.  This alone is a huge showstopper for the cloud.  And only user may use it at a time too.

There are still some cloud providers who offer specifically macOS based products and services (and yes, they run them on the Apple hardware).  Here are a few examples, thanks to this thread:

It’s good to have options here, even if the prices are much higher than what you’d expect.

SCAR: static website deployment on AWS

SCAR is a deployment stack for static websites. It’s not exactly a single-click process, but it is as simple as possible. The name is the abbreviation from the Amazon AWS services which are utilized for the deployment: S3, CloudFront, Amazon Certificate Manager, and Route 53.

The whole thing is built via the Amazon CloudFormation, and shouldn’t require much of tinkering with the services or reading lengthy documentation pages. This bit should also motivate you to try it out:

How much will this cost?


For most sites, it will likely cost less than $1 per month. The cost for a Route 53 hosted zone is fixed at $0.50/month; the remaining CloudFront and S3 costs depend on the levels of traffic, but typically amount to a few cents for small levels of traffic.

Welcome to HTTPS

Finally, after years and years of recommending Let’s Encrypt to everyone, this blog has now followed its own advice and moved to HTTPS. All the old links should be automatically redirected as well, so most people probably won’t notice any difference. But if you do, please do let me know.

Container misconceptions

Ricard Bejarano points out a few container misconceptions. I particular like the bit about Swarm as a better option than Kubernetes for individual projects and small setups (1-2 nodes):

Swarm is Docker, Inc.’s orchestrator. It started development five years ago. It’s built into the Docker Engine, which makes it the same to run it on development machines as in production servers.
In my opinion, it is much less powerful than Kubernetes, and I would vote against using it in a business environment.
That said, I’m a happy admin of a single-node Swarm running all of my personal services at home. But that’s it. I wouldn’t use it for anything with more than 1-2 nodes, but for those applications, I feel is the right tool for the job.