Barnsley fern fractal

Thoughts on software architecture and development, and methods and techniques for improving the quality thereof.

David B. Robins (home)

Code Visions: Improving software quality
I'd like to see my son, please

By David B. Robins tags: Web, Architecture Sunday, November 12, 2017 13:29 EST (link)

We had a large network changeover at work recently, relating to moving from the network of the first company that acquired us to that of the company that merged with them, so all sites are on one network without address conflicts. Unfortunately, the new company's network blocks port 81, and I had been serving static content such as images on that port. With the block, all the images and styles for disappear—something a friend had complained about in the past, presumably because his work had the same block. Lately, most of those images are of our two-month-old son, David Geoffrey Robins. I also pull them to a digital photo frame I made from a Raspberry Pi 3B and Raspberry Pi touchscreen.

I'd write an entry about the digital photo frame, but it's no more complex than the Pi, which I had for my DCC (train automation) work, which has been on hold due to the baby, running Arch Linux, connected to the standard touchscreen I added recently, running qiv (Quick Image Viewer) and some scripts to download and add images from my site when new posts are made.

Anyway, it was time to make an update to serve all content on standard web port 80. (I should note here I'm not trying to circumvent any security measures. All changes are on my end, and they only allow me to view my site, which worked fine for the last several years before the block.) I considered merging the two Apache servers, but a faster method still preserving separate servers was to use a proxy, like I do for A Voluntaryist Wiki, or specifically, a reverse proxy, using Apache's mod_proxy. This is nothing like the kind of proxy used to access general websites that might be blocked (e.g., like Facebook is in China); it's specific to my site, which isn't blocked (just port 81, which is blocked for all sites). I set it up so that any URL beginning with /s would redirect to the static server.

In the past, an image may have lived at

now it lives at

After that change I had to make a few key changes to places in my site's code that had or generated links with the former scheme, and we were back in business… or almost. The Apache ProxyPass directive requires the URL and path to the server (/s and localhost:81 respectively) and there's also a ProxyPassReverse that fixes up redirects, so that if the static server sends a redirect, it gets the /s prefix. I originally used localhost there too; but it instead needs the qualified hostname to be fixed up: in this case. I also used mod_remoteip to translate (proxy only) X-Forwarded-For headers to a source IP for some controls that depend on the origin.

Content on this site is licensed under a Creative Commons Attribution 3.0 License and is copyrighted by the authors.