-
Notifications
You must be signed in to change notification settings - Fork 1
/
.httpd.conf.extract.txt
executable file
·63 lines (52 loc) · 2.46 KB
/
.httpd.conf.extract.txt
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Apache httpd.conf extract providing URL routing and other directives
# Example usage in httpd.conf:
#
# # E-mail aliases management
# Include /path/to/aliases/.httpd.conf.extract.txt
# Use MacroAliases "/aliases" "/path/to/documentroot" "/path/to/credentials/aliases.txt"
<Macro MacroAliases $baseUrl $documentRoot $credentialsFilePath>
# Require HTTPS
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^$baseUrl/ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Require auth throughout
<Location $baseUrl/>
AuthType Ucam-WebAuth
AADescription "Hermes mail alias management"
AAForceInteract On
AuthGroupFile $documentRoot/$baseUrl/.ht-users
Require group editors
</Location>
# Front Controller Application support
Use MacroFrontControllerApplication "$baseUrl/" "E-mail alias management"
# Application directives
RewriteRule ^$baseUrl/([-.a-z0-9]+).txt$ $baseUrl/index.html?domain=$1&action=export [L]
RewriteRule ^$baseUrl/(domain|sources|all).html$ $baseUrl/index.html?action=$1 [L]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/$ $baseUrl/index.html?domain=$1&action=domainhome [L]
RewriteRule ^$baseUrl/([-.a-z0-9]+)$ $baseUrl/$1/ [R]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/(all|sources)/$ $baseUrl/index.html?domain=$1&action=domain$2 [L]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/(all|sources)$ $baseUrl/$1/$2/ [R]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/data.html$ $baseUrl/index.html?domain=$1&action=data [L,QSA]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/sources/([-a-z]+)/$ $baseUrl/index.html?domain=$1&action=domainsources&item=$2 [L]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/sources/([-a-z]+)$ $baseUrl/$1/sources/$2/ [R]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/sources/([-a-z]+)/update/$ $baseUrl/index.html?domain=$1&action=update&item=$2 [L]
RewriteRule ^$baseUrl/([-.a-z0-9]+)/sources/([-a-z]+)/update$ $baseUrl/$1/sources/$2/update/ [R]
# Deny HTTP access to file storage
<LocationMatch ^$baseUrl/([-.a-z0-9]+)/(.+)\.txt$>
Require all denied
</LocationMatch>
# Limit access to hermes, and prevent auto-prepending
<LocationMatch ^$baseUrl/([-.a-z0-9]+)\.txt$>
AuthUserFile $credentialsFilePath
AuthType basic
AuthName "Protected content"
Require user hermes
php_admin_value auto_prepend_file none
php_admin_value auto_append_file none
</LocationMatch>
# Disable any auto-prepending for the data output area
<LocationMatch ^$baseUrl/([-.a-z0-9]+)/data\.html$>
php_value auto_prepend_file none
php_value auto_append_file none
</LocationMatch>
</Macro>