#151

Aug 9, 2021

This was written a day late as I was away visiting friends this weekend, and then deployed a few days late due to a problem with my Concourse set-up. Oh well, only two late posts in nearly three years isn’t bad.

Work

This week I continued looking at Fastly’s Compute@Edge stuff.

I also looked into edge-side includes (ESI) as another option (and possibly less of a change to how we currently do things) but I think I need to ask someone at Fastly some questions about how it all works: eg, if the “main request” sets some response headers, can I feed those into the “ESI request” as request headers (such as if it sets a cookie), or does the “ESI request” just get the request headers from the user? The Fastly ESI docs are pretty bare-bones.

And I implemented a way of sticking flash messages in our session cookie, so we can have the user do something with one frontend app, and redirect them to another frontend app which shows a message (which then disappears on the next page load). The motivating example is email subscriptions, which involves a minimum of two frontend apps:

  1. The user browses to a page (say, rendered by government-frontend) and clicks a button to get email notifications. That button sends the user to the email sign-up journey in email-alert-frontend; where,
  2. The user either logs in (we haven’t implemented this bit yet) or continues without logging in; then,
  3. The user confirms that they want the subscription, and gets redirected back to the page they came from; and,
  4. The user sees a confirmation banner at the top of the page (we haven’t implemented this yet either).

In step 3, we’ll set a flash message from email-alert-frontend which will make government-frontend render the confirmation banner. And because it’s set up so that the flash gets cleared after each request, if the user refreshes the page or navigates elsewhere, the message goes away. This is a pretty common pattern in Rails apps, but it requires a little more care to make it work when you have multiple frontend apps which don’t share the Rails session cookie.

Books

This week I read:

Miscellaneous

This weekend I went to a friend’s house, along with a couple of other friends. It’s the largest (and longest) social gathering I’ve been to since the plague started. I thought it might feel a little weird to begin with, but it didn’t (at least to me); we’d all done rapid lateral flow tests the day beforehand, so we knew the risk of infection was low, and so it was just like any other meetup.

Having to wear a mask for a couple of hours on public transit wasn’t fun though.