Archive for April 2019

Permanent Redirects Get Cached

Published on April 20, 2019

I maintain multiple tools at work that all run in Docker containers on the same machine. The overall setup looks like the following diagram:

Tool Network Diagram

The router container on top (nginx) routes traffic to the various application containers based on the hostname seen in each request (each tool has its own internal domain name). Each application has an nginx container for serving static assets, and a gunicorn container to serve the dynamic parts of the application (using the Django framework).

Earlier this week, I was trying to add a redirect rule to one of my application containers (at the application nginx layer), because a URL was changing. As a convenience for users, I wanted to redirect them to the new location so they don’t get the annoying “404: Not Found” error. I set up the redirect as a permanent redirect using a rewrite rule in nginx. For some strange reason, the port of the application’s nginx layer, which should never be exposed to the outside world, was being appended to the redirect!

Adding the port_in_redirect off; directive to my nginx rules made no difference (or so I thought), and I struggled for an entire day on why this redirect wasn’t working properly. At the end of the day, I learned that permanent redirects are aggressively cached by the browser! This annoyance means you need to clear your browser’s cache to remove bogus redirects. I wasted an entire day because my stupid browser was using a bogus cached reference. Ugh!

Garden Trellis

Published on April 19, 2019

My most recent woodworking project was also the toughest one to assemble. This time around, I built a garden trellis to support the beans and peas my wife planted. Here’s a picture (which you can click to view a larger variant):

Garden trellis
Completed garden trellis

The legs and horizontal frames are all cut with compound miters at 7 degrees. This made assembly difficult, as there weren’t any “flat” surfaces on which I could clamp things together. I purchased a cheap pneumatic nail gun which helped tremendously with this, but it was still a challenge. In the end, I think the final product looks pretty nice. Woodworking is a real fun hobby!

Switzerland by Rail

Published on April 6, 2019

My wife and I often daydream about returning to Switzerland. One of the things we loved most about our trip there was the ability to go everywhere we needed via public transportation, most often on trains. Imagine my delight when, purely by chance, I recently happened upon a YouTube channel that is nothing but rail trips through Switzerland from the driver’s point of view! There are hours and hours of videos, so I know what I’ll be watching over the next few days.

Copyright © 2004-2019 Jonah Bishop. Hosted by DreamHost.