RewriteLock "/var/cache/thruk/apache_rewrite.lock"
RewriteMap  users prg:/usr/share/thruk/script/thruk_auth

# make all cookies accessible by the url
RewriteCond %{REQUEST_URI}           !^/thruk/cgi-bin/restricted.cgi
RewriteRule ^/(.*)$                  /%{HTTP_COOKIE}/%{REMOTE_ADDR}/____/$1 [C,NS]
RewriteRule ^(.*)$                   ${users:$1|/loginbad/}  [C,NS]
RewriteRule ^/pass/(.*)$             /$1 [NS,PT,L,E=!REMOTE_USER]
RewriteRule ^/redirect/(.*)$         /$1 [NS,L,R=302]
RewriteRule ^/loginok/([^/]+)/(.*)$  /$2 [NS,PT,L,E=REMOTE_USER:$1]

<LocationMatch ^/thruk(?!/cgi-bin/restricted.cgi)>
    Order allow,deny
    Allow from all
    Satisfy any
</LocationMatch>
