RewriteEngine On
RewriteRule ^/$ /koji/  [R,L]
KeepAlive On

ServerLimit 800
MaxRequestWorkers 800
MaxConnectionsPerChild 1000

#We use wsgi by default
Alias /koji "/usr/share/koji-web/scripts/wsgi_publisher.py"
#(configuration goes in /etc/kojiweb/web.conf)

Alias /robots.txt /var/www/html/robots.txt

<Directory "/var/www/html">
    Options None
    AllowOverride None
    Require all granted
</Directory>

# Python 3 Cheetah expectes unicode everywhere, apache's default lang is C
# which is not sufficient to open our templates
WSGIDaemonProcess koji lang=C.UTF-8

<Directory "/usr/share/koji-web/scripts/">
    Options ExecCGI
    SetHandler wsgi-script
    WSGIApplicationGroup %{GLOBAL}
    WSGIProcessGroup koji
    WSGIScriptReloading Off
    Require all granted
</Directory>

<Location /koji/login>
    AuthType GSSAPI
    GssapiSSLonly Off
    AuthName "GSSAPI Single Sign On Login"
    GssapiCredStore keytab:/etc/krb5.HTTP_koji{{env_suffix}}.fedoraproject.org.keytab
    Require valid-user
</Location>


Alias /koji-static/ "/usr/share/koji-web/static/"

<Directory "/usr/share/koji-web/static/">
    Options None
    AllowOverride None
    Require all granted
</Directory>

Alias /repos "/mnt/koji/repos/"

<Directory "/mnt/koji/repos/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

Alias /scratch "/mnt/koji/scratch/"

<Directory "/mnt/koji/scratch/">
    Options Indexes
    Require all granted
</Directory>

Alias /work "/mnt/koji/work/"

<Directory "/mnt/koji/work/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

Alias /buildgroups "/mnt/koji/buildgroups/"

<Directory "/mnt/koji/buildgroups/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

Alias /kojira "/mnt/koji/kojira/"
<Directory "/mnt/koji/kojira/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

{% if env == "production"  %}
# use redirects for compose and packages locations
RewriteRule ^/compose(.+) https://kojipkgs.fedoraproject.org/compose$1  [R=301,L]
RewriteRule ^/packages(.+) https://kojipkgs.fedoraproject.org/packages$1  [R=301,L]
{% else %}
Alias /compose "/mnt/koji/compose/"
<Directory "/mnt/koji/compose/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

Alias /ostree "/mnt/koji/ostree/"
<Directory "/mnt/koji/ostree/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

Alias /packages "/mnt/koji/packages/"

<Directory "/mnt/koji/packages/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>

Alias /repos-dist "/mnt/koji/repos-dist/"

<Directory "/mnt/koji/repos-dist/">
    Options Indexes FollowSymLinks
    Require all granted
</Directory>
{% endif %}
