KeepAlive off
# Unencrypted access is bad
# Un-comment the following to force https connections
RewriteEngine on
#RewriteCond %{REQUEST_URI} !^/rpms/.* [NC]
#RewriteCond %{REQUEST_URI} !^/repos/.* [NC]
#RewriteCond %{REQUEST_URI} !^/harness/.* [NC]
#RewriteCond %{REQUEST_URI} !^/kickstart/.* [NC]
#RewriteCond %{REQUEST_URI} !/ipxe-script$ [NC]
#RewriteCond %{HTTPS} off
#RewriteRule ^/(.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule   ^/bkr$  /bkr/   [R]

Alias /static /usr/share/bkr/server/static
Alias /bkr/static /usr/share/bkr/server/static
Alias /bkr/assets/generated /var/cache/beaker/assets
Alias /bkr/assets /usr/share/bkr/server/assets
Redirect permanent /bkr/apidoc http://beaker-project.org/docs/server-api
Alias /logs /var/www/beaker/logs
Alias /rpms /var/www/beaker/rpms
Alias /repos /var/www/beaker/repos
Alias /harness /var/www/beaker/harness

<Directory "/var/www/beaker/logs">
    <Files "*.log">
        ForceType text/plain
    </Files>
</Directory>

# To work around a thread safety issue in TurboGears where HTTP requests will
# sometimes fail with NoApplicableMethods during application startup, it is
# recommended to set threads=1 here.
# See https://bugzilla.redhat.com/show_bug.cgi?id=796037 for details.
WSGIDaemonProcess beaker-server user=apache group=apache display-name=beaker-server maximum-requests=1000 processes=8 threads=1
WSGISocketPrefix /var/run/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
WSGIPythonOptimize 2
WSGIPassAuthorization On

WSGIScriptAlias /bkr/ /usr/share/bkr/beaker-server.wsgi/bkr/

<Directory /usr/share/bkr>
    WSGIApplicationGroup beaker-server
    WSGIProcessGroup beaker-server
    Require all granted
</Directory>

<Directory /var/cache/beaker/assets>
    Require all granted
    # Generated assets have a content hash in their filename so they can
    # safely be cached forever.
    ExpiresActive on
    ExpiresDefault "access plus 1 year"
</Directory>

# Authentication settings for GSSAPI logins.
# Uncomment and customize for your environment
#<Location /bkr/login>
#    AuthType GSSAPI
#    AuthName "Beaker Auth"
#    GssapiCredStore keytab:/etc/httpd/conf/httpd.keytab
#    GssapiSSLonly On
#    GssapiBasicAuth On ; fallback to BasicAuth
#    Require valid-user
#</Location>

