-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhtaccess.example
More file actions
26 lines (23 loc) · 831 Bytes
/
htaccess.example
File metadata and controls
26 lines (23 loc) · 831 Bytes
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
# Adjust /path/to/application everywhere below as appropriate
# /path/to/application/.htaccess
Options +ExecCGI
AddHandler cgi-script .py
SetEnv INTR_TASKS_FILE "/path/to/application/data/tasks.json"
SetEnv INTR_DONE_DIR "/path/to/application/data"
<FilesMatch "^(tasks|done)\.py$">
AuthType Basic
AuthName "INTR Task Tracker"
# Even better, feel free to put this one level up
AuthUserFile "/path/to/application/.htpasswd"
<RequireAll>
# Adjust network address range as appropriate
Require ip 127.0.0.1 192.168.1.0/24
# Authorization logic
<RequireAny>
# Allow anonymous GET or HEAD
Require expr "%{REQUEST_METHOD} in {'GET','HEAD'} && -z req('Authorization')"
# Need valid-user for POST or already logged in
Require valid-user
</RequireAny>
</RequireAll>
</FilesMatch>