Apache basic authentication except for those Allowed

前端 未结 5 800
一个人的身影
一个人的身影 2020-12-13 19:59

Problem: I have some files under /var/www/files/ that I want them to be accessed from specific IP addresses WITHOUT requiring user/password. However, I would like that any o

5条回答
  •  心在旅途
    2020-12-13 20:28

    If your server is behind a proxy, you can't rely on the Require ip directly. However, you can use the Require env:

    
    
        AuthType Basic
        AuthName "Please enter your username and password"
        AuthUserFile /var/www/files/.htpasswd
    
        SetEnvIF X-Forwarded-For "22.33.44.55" AllowIP
    
        
          Require env AllowIP
          Require valid-user
        
    
    
    

    The source of the idea

提交回复
热议问题