Good day everyone! I've got a question related to Basic Authorization and Home 
directory detection.  Namely, I want to configure the webserver in such a way 
that it allows to do autoindex if user is browsing their home directory.  I 
tried to declare an environment variable first, but then realized that I am 
unable to use it inside If directive.

For example:

SetEnvIf Request_URI ^/(.*)/ URI_HOME=$1
SetEnvIf Authorization "^Basic (.*)$" X_HTTP_AUTHORIZATION=$1
SetEnvIfExpr "unbase64(%{ENV:X_HTTP_AUTHORIZATION}) -strcmatch 
'%{ENV:URI_HOME}:*'" USER_IS_IN_HOME_DIR

Then it tried to put the extraction of username info If clause.  But I cannot 
figure out how to use regexp inside it or some substring function to remove 
"Basic " prefix.
I have seen how it is done on wiki page:
https://cwiki.apache.org/confluence/display/httpd/LogBasicauthenticationusername
But again, RequestHeader runs after any If directove so I am unable to 
configure Autoindex for my purposes.
Any ideas how it can be done?

Reply via email to