My Trac system has basic http authentication, configured like so:
AuthType Basic AuthName "TRAC" AuthUserFile /var/trac/trac-auth-file Require valid-user
This works in that it prompts for a username and password and only allows the user to access Trac if their credentials are validated.
Failing to provide any credentials (i.e. pressing cancel on the prompt) gives a 401 Authorization Required error.
However, what I actually want to happen is instead of a 401, it just allows the user access as an anonymous user.
The Trac system itself supports an anonymous user - in the trac permissions settings, there are a whole heap of privileges that can be configured for anonymous users.
I just don't know how (or even if it is possible) to configure the htaccess so a htpasswd file is used, but have it fall back to anonymous access rather than error with a 401