Prevent browsers from caching redirects

I use redirects for dynamic short urls where the destination url will change on a frequent basis. Unfortunately, browsers cache 301 redirects.

To prevent a 301 redirect from being cached just set the cache control headers, then you can undo the redirect and clients (bot and browsers) will no longer get redirected.

Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"

A http status code 301 without caching can be used to do URL canonicalization while retaining the tracking functionality.