WSGISocketPrefix run/wsgi
#WSGIRestrictStdout On
WSGIRestrictSignal Off
WSGIPythonOptimize 1
WSGIPassAuthorization On
WSGIDaemonProcess pagureproc user=pagure group=packager maximum-requests=1000 display-name=pagure processes={{ wsgi_procs }} threads={{ wsgi_threads }} inactivity-timeout=300
WSGIProcessGroup pagureproc
WSGIScriptAlias / /var/www/pagure.wsgi

Protocols h2 http/1.1

#  SSLEngine on
#  SSLProtocol all -SSLv2 -SSLv3
#  # Use secure TLSv1.1 and TLSv1.2 ciphers
#  Header always add Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

#  SSLCertificateFile /etc/pki/tls/certs/pagure.io.cert
#  SSLCertificateChainFile /etc/pki/tls/certs/pagure.io.intermediate.cert
#  SSLCertificateKeyFile /etc/pki/tls/certs/pagure.io.key

{% if env == "staging" or datacenter == "iad2" %}
  Alias /static /usr/lib/python3.6/site-packages/pagure/static/
{% else %}
  Alias /static /usr/lib/python2.7/site-packages/pagure/static/
{% endif %}
  Alias /grokmirror /srv/git/grokmirror
  <Location />
   WSGIProcessGroup pagureproc
  </Location>

#</VirtualHost>

# Redirect files viewed in master to the main branch
# https://pagure.io/fedora-infrastructure/issue/9620
RedirectMatch 302 (.*)/rpms/(.*)blob/master/(.*)  $1/rpms/$2/blob/rawhide/$3
RedirectMatch 302 (.*)/container/(.*)blob/master/(.*)  $1/container/$2/blob/rawhide/$3
RedirectMatch 302 (.*)/flatpaks/(.*)blob/master/(.*)  $1/flatpaks/$2/blob/stable/$3
RedirectMatch 302 (.*)/tests/(.*)blob/master/(.*)  $1/tests/$2/blob/main/$3


RewriteEngine on

# First try the instance-specific theme
RewriteCond "/usr/share/pagure_dist_git/static/$1" -f
RewriteRule "^/static/(.*)" "/usr/share/pagure_dist_git/static/$1" [L]

# Use the application default theme for files not customized
{% if env == "staging" or datacenter == "iad2" %}
RewriteRule "^/static/(.*)" "/usr/lib/python3.6/site-packages/pagure/static/$1" [L]
{% else %}
RewriteRule "^/static/(.*)" "/usr/lib/python2.7/site-packages/pagure/static/$1" [L]
{% endif %}
