Allow the middleware to be configured with a 'ua' option.

Update tests and docs to ensure this functionality works.