Ep 12: The Snook makes a Hot Toddy. Perfect drink for a cold and rainy winter’s night!
I’ve got a new iPhone with Portrait mode, and the first thing I’ve used it on is this Maple Walnut Cornbread I baked tonight. 😍
Snoozing.
Ep 12: The Snook makes a Hot Toddy. Perfect drink for a cold and rainy winter’s night!
I’ve got a new iPhone with Portrait mode, and the first thing I’ve used it on is this Maple Walnut Cornbread I baked tonight. 😍
Snoozing.
Good gracious. This morning I thought I’d just do a quick task on my migrated Lightsail sites: setting up a Lambda function to check every 5 minutes, see if the page contains some specific text, and send me an alarm if the site isn’t up. My first thought was to use CloudWatch Synthetics, but the pricing is a lot higher than just doing it yourself with a Lambda function (though you don’t get spiffy screenshots and such). I kept it simple and happily discovered there’s an existing lambda-canary blueprint available. So I set that up, pointed it at https://www.roalddahlfans.com, and tested it out. It worked great!
Then the Snook, looking over my shoulder, said, “That’ll be going through CloudFront. Why don’t you point it at the origin subdomain so you know it’s hitting the real WordPress underneath?” Okay, sure. Just to double-check it was working, I went to the origin subdomain in the browser… and was redirected to www. What. Uh, that’s not good. Thinking I had screwed something up, I tried hitting the origin subdomain of web-goddess.org… and that worked correctly, not redirecting to www. What the hell. Why were my two sites behaving differently? And why wasn’t RoaldDahlFans’s CloudFront distro barfing that I had set it up with an origin that was redirecting to itself??
Over the next seven hours – seriously – the Snook and I beat our heads against this problem. I tried turning on and off various plugins; I grepped both filesystems multiple times looking for differences; I completely rebuilt the CloudFront distribution for RoaldDahlFans; I turned SSL off and on repeatedly; I fiddled with heaps of htaccess settings… and we got nowhere. We determined that on web-goddess, if I went to https://web-goddess.org, it would be redirected to www; but for any other subdomain (foo.web-goddess.org, etc) it would not. But on RoaldDahlFans, it would always go to www regardless of whether you used a subdomain or not. It was so frustrating.
Various people chimed in pointing us to various things, without much success. My buddy Peter Wilson mentioned thinking that WordPress had some special behaviour to redirect between www and non-www domains, which eventually ended up in us poring over the redirect_canonical code. The Snook noticed that another thing this module does is try to redirect you to the correct page if you type in a URL wrong. For example, if you try to access https://web-goddess.org/about, WordPress will automatically redirect you to https://www.web-goddess.org/about-me (which is the real address). However, if you do that on any subdomain other than www or non-www, it gives a 404. He went to test whether that was also held true for RoaldDahlFans, and to his surprise, the origin was not redirected! What the hell.
We determined that the origin subdomain was only redirecting to www on RoaldDahlFans on the homepage. Every other page on the origin subdomain would not redirect. So what’s special about the homepage for RoaldDahlFans.com compared to web-goddess? Well, web-goddess has the homepage set to show the most recent posts, but RoaldDahlFans uses a static page. I changed RoaldDahlFans.com to use the most recent posts, hit up the origin subdomain, and it did NOT redirect. But when I changed it back to a static page, it went back to redirecting.
SO – there is something in the way WordPress handles sites with static homepages that causes them to be redirected to the Site URL, even if you’re using a random subdomain. If you add anything to the path – subdomain.roalddahlfans.com/index.php, it won’t trigger the redirect. How weird is that?
Okay, so that finally explains the difference in behaviour between the two sites. My origin subdomain for RoaldDahlFans.com was going to redirect requests for the homepage to www, and there was nothing I could do about it. Which meant that when CloudFront needed to refresh its cache for the homepage, it would hit the origin subdomain… and be redirected to itself? Why wasn’t I seeing an infinite redirect loop crashing my site?
Cue another hour of poking around. The only way it wasn’t going to crash, the Snook reasoned, was if CloudFront was passing the Host header through to the origin as part of the request. I was not aware of telling it to do that, but…
It turns out that the AWS WordPress plugin, when it set up my CloudFront distribution, helpfully whitelisted the Host header as part of the default behaviour for the site. This is why CloudFront isn’t barfing every time the homepage cache expires.
So there you have it. What I thought would be a fifteen-minute task sent us down a rabbithole of WordPress, redirects, and content delivery network intricacies. The irony is that after all that, nothing is actually incorrect on my site! It’s all working as intended. We just didn’t know how. The only catch is that if I myself want to bypass CloudFront on RoaldDahlFans.com, I need to append /index.php when I hit the origin subdomain.
This was not how I intended to spend my Sunday… 😅
I’ve got a new iPhone with Portrait mode, and the first thing I’ve used it on is this Maple Walnut Cornbread I baked tonight. 😍
@jcnsingapore @kcarruthers @katejinx Totes. *cringe*
5:57pm – I message @gilmae that I am winning at the tech this weekend.
7:10pm – It’s nothing but Heisenbugs and race conditions, everywhere I look.
I deserved that. 😩
RT @HeartOfPluto_: Thanks to Disney+ I saw the famous #Hamilton broadway musical for the first time and I finally understand why I get so m…
Following on from my previous post detailing how I moved this site from shared webhosting to Amazon Lightsail, I’ve since completed a few more of my To Do list items:
Rebuilding a Passap E6000 computerised knitting machine – That is SO COOL. https://t.co/ILvYo6xnEn (Thanks @apocraphilia for the link!) https://t.co/AyiMB3bc7e
RT @ryanjhiggins: The symbolism of Betsy DeVos having a bookshelf with no books on it 😂😂😂 https://t.co/UMYh8Pv2Nq
RT @moorehn: Every woman in leadership who has been told to reduce her visibility so that a man could have more: Please stand up.
https:…
The cool thing is, every bit of advice in this mentoring article is equally applicable to tech, if you just swap out the different industry. https://t.co/b96NS72eJu
@pjf @evanderkoogh Good for you all. I went to the Broadway Shopping Center in Sydney and it was < 5% wearing masks. 🙁
RT @RoaldDahlFans: Are you a serious Dahl collector? You should check out Richard Walker’s “Guide to Collecting Dahl First Editions”! https…
No. https://t.co/SbnejkcWoy
@MichelePlayfair Ugh, do I even want to know? 🙁
RT @glasnt: You have a 0% chance of being accepted if you don’t submit anything!
Worst case, you don’t get accepted, but you get experienc…
@MelissaKaulfuss Well, you’ve made me want them now, so at least you’ve spread it around.
@laimelde @qikipedia In America it’s just linen, that you put in the linen closet.
@StampsCom Australia is not on any of those suspended lists, and the last update for it appears to be from April.
RT @tmclaughbos: Enjoy or want to learn AWS serverless?
Tired of social isolation and want folks to hangout with?
Sign up for the Serverl…
@melissa_loh My favourite part is how they rolled it out without actually making sure it works for all functionality, which means fun things like going into the tools for a Page and seeing warnings that it won’t work in the new UI.
@gilmae The number of times @the_snook has given me an odd look for watching the same shows over and over and over… is a lot.
I checked my lists. There’s a lot. Nothing too controversial, but there are some real head scratchers in there… 🤔
Tech Heads
Fibery Tweeple
Tatters (I don’t tatt!)
Awesome People
smart-socialmedia-people
Old-school-bloggers
Gr8 Ppl 2 flw in EdTech (Huh?!)
Meatspace https://t.co/SwxbU05lue
Arduino-people
Visual Content Savvy (💅)
Forward Thinkers (I take this as a compliment)
Interesting
Actual People (Uh, thanks.)
GRL PWR (✊)
Vegemite
Tech Feminism
Lady Geeks
Xxx Haskell (NOOOO)
Chix0rs
Not “Guys” DevRel Folks
El valor de la marca (wtf?)
Miscellany
Downunder
Hey @StampsCom – my mom sent me my uni diploma via expedited international shipping two weeks ago, and the tracking hasn’t been updated in 10 days since it departed Chicago. Starting to get very nervous here…
@AndrewADavidson @beccagarciatech Actually, that’s 8am here in Sydney so it’s doable. Happy to help! Feel free to DM me to discuss if you like. (Thanks for the tip, Andrew!)
In case you haven’t heard yet (or seen it on social media), in the next few months I’m going to be transferring to a new team at AWS. This is super exciting, and I’ll share more about the new role once I’m able. But in the meantime, that means that my existing team has an opening for a Solutions Architect Manager! We’re looking for someone who is passionate about helping Aussie businesses reap the benefits of moving to the Cloud, as well as growing and coaching an amazing team of technical folks. Bonus – you get to work with an awesome team of really smart folks! The job description is here, and it’s worth noting that the role is open to both Sydney and Melbourne! Hit me up if you have any questions about it…
My name is Kris. I’ve been blogging since the 90’s. I live in Sydney, Australia, and I spent most of my career in the tech industry.
No AI used in writing this blog, ever. 100% human-generated.
Congrats and to many more 🙌🏽
My home economics teacher taught us to use “J cloths” as press cloths. (Cellulose cleaning cloths). The upside of using…
Special thanks to Matt Hinrichs for the site logo!
Woot, my knee-jerk don’t-overthink-it pub-quiz answer was Iran which seems to be [✓]. I ‘knew’ it was more populous than…