With that introduction, I'm writing here to describe my new preferred solution for carrying pepper spray on rides: a mounting bracket that mounts underneath a water bottle cage, similar to many tire pump mounts. In fact, one of my bikes has the tire pump mount on one side of the water bottle and the pepper spray mount on the other side. This solution makes the pepper spray much more accessible when needed on short notice than a jersey pocket, for example.
I have bought multiple different brand pepper sprays, and they all have approximately the same dimensions. This bracket should work for any standard pepper spray, such as the one pictured below, which has a diameter of about 21 mm or 13/16 of an inch.
Like some of my other 3D printed projects, this bracket was designed using OpenSCAD. It works well for this type of design, though it's not necessarily suited to more complex designs. I got a prototype printed by Shapeways, and the first version looks like this:
Similar to many tire pump mounts, this mounting bracket has mounting holes that offer a certain amount of lateral adjustment in the placement, which allows the outer mount to be placed a range of distances from the down tube or seat tube of the bike. This is important because so many modern bikes, particularly those with carbon frames, have bigger diameter tubes in the down tube of the frame than in the past.
This picture shows the mounted bracket with a water bottle in the bottle cage.
Here is the bracket with pepper spray attached.
With the pepper spray in this position, it should be easily and quickly reachable by any rider accustomed to reaching down for a water bottle while riding. It has now been used for some off-road riding and has held the pepper spray securely so far. A bracket like this can be purchased from Shapeways via the product page I created.