jeudi 3 septembre 2020

Apache Location match with ! and && rule (

My current directive is as below and it works

 <LocationMatch ^/scm>
       Satisfy Any
       Allow from all
       AuthType None
       Require all granted
    </LocationMatch>

however, my requirement is to execute above LocationMatch only if login sting not present

My Method 1:

<LocationMatch "^(?!\/login) && ^/scm">
   Satisfy Any
   Allow from all
   AuthType None
   Require all granted
</LocationMatch>

Not working as expected.

Q1) Is it possible to add "&&" in the LocationMatch?

Q2) I tried with the below method however not working.

   <LocationMatch ^/scm>
   <If "%{QUERY_STRING} =~ /login/">
    <If>
    <Else>
           Satisfy Any
           Allow from all
           AuthType None
           Require all granted
      </Else>
      </LocationMatch>

Q) I tried the "http://antoniolorusso.com/2011/01/04/exclude-files-and-directories-from-apache-auth/" method however still location /login will expect the user to Authenticate again.

Seeking guidance/suggestion in this regard to fixing the configuration. Provie your inputs.

Aucun commentaire:

Enregistrer un commentaire