Categories:
| February 2012 | ||||||
|---|---|---|---|---|---|---|
| S | M | T | W | T | F | S |
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | |||
Monthly Archives:
Most recent entries:
Syndicate:
Apache htpasswd if not certain IP
This is a reoccuring problem I frequently come across when developing website’s:
You have one or more files that are accessible from the web but you only want them to be available when the user enters the right user/password combination.
No problem you say here with an htaccess/htpasswd protection this is solved.
Only when you want to have a cronjob script to access those same files you need to write authentication and store an user/pass combination in this script.
Well, I finally found a way to tell Apache to check for a certain IP (127.0.0.1) and allow that or force the user to authenticate with htpasswd.
How?
AuthUserFile /path/to/user.pass AuthGroupFile /dev/null AuthName "Private" AuthType Basic Satisfy Anyorder deny,allow deny from all allow from 127.0.0.1 require valid-user
Give special attention to ‘Satisfy Any’ in the above code, this will configure Apache to allow access by IP or user/pass combination.
Comments
Geplaatst door WilliamFarthowe op 06-Dec-11 13:12
I’ve read your post and I’m interested on it. Thank you for sharing. When Essay Writing Help me with of some code and your blog post appears on it. thanks!