Following on from the previous post: I’m so slow/dumb sometimes. Of course it’s possible to redirect http requests to https with Bozohttpd, the very fact I’m running two instances of this makes this possible.
For the httpd (non-https) instance configure it with a different virtual root directory, e.g:
httpd_flags="-S bozohttpd -v /var/www/vredirectroot -M .html 'text/html; charset=utf-8' '' '' -M .xml 'text/xml; charset=utf-8' '' ''"
Then within that directory create the virtual host directory so you have a path like so:
/var/www/vredirectroot/atomicules.co.uk
And then within that directory just place a .bzabsredirect
file:
sudo ln -s https://atomicules.co.uk .bzabsredirect
Restart that bozohttpd instance:
sudo /etc/rc.d/httpd restart
And “hey presto!” it works.
[EDIT: 2017-07-31] Spoke too soon. It’s too simplistic. It redirects just the path with the .bzabsredirect
file is. So although http://atomicules.co.uk/
merrily redirected to https://atomicules.co.uk
an existing blog post like http://atomicules.co.uk/2017/13/32/somepost.html
just 404s. Poop. Ok, I think I’ll have to go back to duplicating http and https again for the time being otherwise I’ll break a load of links - well a handful. One thing .bzabsredirect
will work for is redirecting www.atomicules.co.uk
on it’s own, I’d just left that broken for now. I might take a look at HAProxy as I’m not moving off Bozohttpd.