" Web Design "

Matt the AI Web Guy Title Card

Beyond the Hype: How AI is reshaping the future of professional web development

I recently pushed myself out of my normal comfort zone and volunteered to a talk at the newly re-launched Bristol WordPress People meet-up. This group has a special affinity for me as I used to attend their meet-ups before the pandemic and it’s actually how I discovered Atomic Smash, the company I currently work for.

I’d decided to do my talk on AI and how it’s changing web development as this is an area I’ve been experimenting in at work to find ways to be more efficient and increase my personal productivity. After some last minute tweaks to my presentation on a family holiday to Portugal I was as ready to give my talk.

Prior to this meet-up there had been a few at a local pub in Bristol that attracted some attendees but the numbers were much lower than the pre-pandemic meet-ups so I was expecting a small room of maybe 10-15 people, so I was surprised to see the numbers had grown to 50 people when I checked the MeetUp app which didn’t help my nerves. On the actual evening we had somewhere between 35-40 people actually turn up!

After introductions I began my talk and immediately noticed the tell-tale sign of a migraine coming on with the flashing aurora starting to block parts of my vision, I’ve suffered from these since I was 18 and get them a couple of times every year but I felt the timing of this one was particularly frustrating. I powered through despite being barely able to see my notes on the laptop screen and although there were technical issues, lots of ums and pauses, and a live demonstration of an AI tool that didn’t go as planned, I made it to the end and spent an equal amount of time answering the many questions people had about the tools I use, AI in general, and the future of web development.

For those that weren’t able to attend but are interested in the subject, I’ve made my slides, notes, and a video of the event available:

Click here to view the slides full screen or click here to view my notes.

The video was recorded on my phone last minute as we hadn’t planned to video anything so the quality isn’t professional but I’ve edited it down to a watchable length and enhanced the audio (using an AI tool called ):

Click here to watch the video on YouTube.

Laravel Forge Screenshot

Fixing the nginx $_SERVER[‘HTTPS’] issue on a Laravel Forge Load Balancer

Recently I’ve been experimenting with Laravel Forge and Linode to build a new server platform for the new CloudMonitor app I’m currently building (http://www.rockandscissor.com), and after a couple of attempts and quite a few support tickets to Taylor Otwell, Creator of Laravel and Forge, I’ve finally managed to configure a Load Balancer and 2 servers running a MySQL Master-Master sync, and using Unison to keep the web directories synced.

However I came across a problem which is fairly common on Load Balanced or Reverse Proxy setups that use SSL. The Load Balancer itself terminates the SSL connection on port 443 and the traffic is sent from the Load Balancer to the servers across the local network on port 80. The problem arises with any software that uses the $_SERVER[‘HTTPS’] = ‘on’ global variable such as WordPress, Magento, OpenCart etc due to this global variable not being set, this is because traffic comes to the server through HTTP (port 80) instead of HTTPS (port 443).

So how do we fix this? Well even though this isn’t technically a bug (please excuse my title on this article) as the traffic isn’t coming to the server in a secure fashion, and the $_SERVER[‘HTTP_X_FORWARDED_PROTO’] global variable is set to indicate which protocol is being used to the server. Unfortunately for reasons I’ve yet to discover, and I’m sure there are technical reasons, the software mentioned above doesn’t look at this additional variable to do SSL detection. The most common solution for this problem is to modify your source code to look at this global variable, or to install a plugin/module that incorporates the workaround. Whilst this would fix the problem I wanted to find a way to add this fix that would work for any application I decided to install without having to modify the core source code or add additional plugins/modules. On each of the servers you will need to edit your nginx configuration files and change the following code section from this:

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

to this (add in the red lines to the existing code):

set $my_http "http";
set $my_ssl "off";
set $my_port "80";

if ($http_x_forwarded_proto = "https") {
set $my_http "https";
set $my_ssl "on";
set $my_port "443";
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS $my_ssl;
include fastcgi_params;
}

Many thanks to Taylor Otwell for responding to my continuous questions and Sonassi.com for their great article which pointed me in the right direction for my Nginx Reverse Proxy/Nginx setup: Magento HTTPS Re-direct Loop.